-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbipartite.cpp
More file actions
83 lines (78 loc) · 1.29 KB
/
bipartite.cpp
File metadata and controls
83 lines (78 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//AnkitCode99
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define all(v) (v.begin(),v.end())
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define nrep(i,a,b) for(long long int i=a;i>=b;i--)
using namespace std;
vl ar[2001];
ll vis[2001],col[2001];
bool dfs(ll node,ll c)
{
vis[node]=1;
col[node]=c;
for(ll child:ar[node])
{
if(vis[child]==0)
{
bool res=dfs(child,c^1);
if(res==false)
return false;
}
else
{
if(col[node]==col[child])
return false;
}
}
return true;
}
int main()
{
fast;
#ifndef ONLINE_JUDGE
freopen("IP.txt","r",stdin);
freopen("OP.txt","w",stdout);
#endif
ll t;
cin>>t;
rep(i,1,t+1)
{
ll n,m;
cin>>n>>m;
rep(j,1,n+1)
{
ar[i].clear();
}
rep(j,1,m+1)
{
ll a,b;
cin>>a>>b;
ar[a].pb(b);
ar[b].pb(a);
}
bool flag=true;
rep(j,1,n+1)
{
if(!vis[j])
{
bool res=dfs(j,0);
if(!res)
{
flag=false;
}
}
}
cout<<"Senario #"<<i<<endl;
if(flag)
cout<<"No suspicious bugs found!\n";
else
cout<<"Suspicious bugs found!\n";
}
}