delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

View File

@ -0,0 +1,43 @@
#include<cstdio>
#include<vector>
using namespace std;
int n,s;
vector<int> G[1001];
int color[1001];
void init()
{
int a,b;
scanf("%d%d",&n,&s);
for(int i=0;i<s;i++)
{
scanf("%d%d",&a,&b);
G[a].push_back(b);G[b].push_back(a);
}
}
bool dfs(int v,int c)
{
color[v]=c;
for(int i=0;i<G[v].size();i++)
{
if(color[G[v][i]]==c) return 0;
if(color[G[v][i]]==0&&!dfs(G[v][i],-c)) return 0;
}
return 1;
}
void solve()
{
for(int i=0;i<n;i++)
if(color[i]==0)
if(!dfs(i,1))
{
printf("No\n");
return;
}
printf("Yes\n");
}
int main()
{
init();
solve();
return 0;
}