Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************************************************
- * ####### # *
- * # # # ###### # # # # #### # # # # # *
- * # # # # # # ## # # # # # # # *
- * # ###### ##### # # # # # #### ###### # # # *
- * # # # # ####### # # # # # # # # # *
- * # # # # # # # ## # # # # # # # *
- * # # # ###### # # # # #### # # #### ###### *
- ***************************************************************************/
- #include<bits/stdc++.h>
- #define ll long long
- #define pb push_back
- #define endl '\n'
- #define pii pair<ll int,ll int>
- #define vi vector<ll int>
- #define all(a) (a).begin(),(a).end()
- #define F first
- #define S second
- #define sz(x) (ll int)x.size()
- #define hell 1000000007
- #define rep(i,a,b) for(ll int i=a;i<b;i++)
- #define lbnd lower_bound
- #define ubnd upper_bound
- #define bs binary_search
- #define mp make_pair
- using namespace std;
- #define N 100005
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- int TESTS=1,fuck;
- cin>>TESTS;
- for(fuck=1;fuck<=TESTS;fuck++)
- {
- ll n,m,x,y;
- cin>>n>>m;
- vi col(n+1,-1);
- vi a[n+1];
- rep(i,0,m)
- {
- cin>>x>>y;
- a[x].pb(y);
- a[y].pb(x);
- }
- bool f=true;
- ll top;
- queue<ll>q;
- rep(i,1,n+1)
- {
- if(col[i]==-1)
- {
- q.push(i);
- col[i]=1;
- while(!q.empty() && f)
- {
- top=q.front();
- q.pop();
- for(auto j:a[top])
- {
- if(col[j]==-1)
- {
- col[j]=1-col[top];
- q.push(j);
- }
- if(col[j]==col[top])
- {
- f=false;
- break;
- }
- }
- }
- }
- if(!f)
- break;
- }
- if(!f)
- {
- cout<<"Scenario #"<<fuck<<":\nSuspicious bugs found!\n";
- }
- else
- cout<<"Scenario #"<<fuck<<":\nNo suspicious bugs found!\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement