Description
Ask if there is a two staining scheme for each point that has a connection to the point where he does not have the color.
Sol
Concluding questions.
Except for one point, any graph can be stained by two.
Code
/************************************************************** problem:2079 user:beiyu language:c + + result:accepted time:1284 ms memory:2068 kb****************************************************** /#include <bits/stdc++.h>using namespace std; const int N = 2E5+50; int N,m;int D[n]; inline int in (int x=0,char Ch=getchar ()) {while (ch> ' 9 ' | | ch< ' 0 ') Ch=getchar (); while (ch>= ' 0 ' && ch<= ' 9 ') x=x*10+ch-' 0 ', Ch=getchar (); return x; }int Main () { n=in (), M=in (); for (int i=1,u,v;i<=m;i++) u=in (), V=in (), (u!=v?d[u]++,d[v]++:0); for (int i=1;i<=n;i++) if (!d[i]) return puts ("NIE"); Return puts ("TAK"), 0;}
Bzoj 2079: [Poi2010]guilds