-
Notifications
You must be signed in to change notification settings - Fork 1
/
CV2D.cpp
48 lines (46 loc) · 1.01 KB
/
CV2D.cpp
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
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> V[55];
int color[55];
int c;
bool ans=true;
int main()
{
int i,n,m;
cin>>n>>m;
int u,v;
int arr[55]={0};
for(i=0;i<m;i++)
{
cin>>u>>v;
V[u].push_back(v);
V[v].push_back(u);
arr[v]=1;
arr[u]=1;
}
queue<int> Q;
for(i=1;i<=n;i++)
{
if(!color[i])
{
Q.push(i);
color[i]=1;
while(!Q.empty())
{
int x=Q.front();
Q.pop();
for(i=0;i<V[x].size();i++)
{
color[V[x][i]]
}
}
}
}
if(ans)
cout<<"Yes";
else
cout<<"No";
// cin>>i;
return 0;
}