Bzoj2079[poi2010]guilds
Test instructions
To dye a graph, it is required that each figure must be infected with a certain color at the same time as the point of another color connected to the edge, ask can meet the requirements. n≤200000.
Exercises
Direct conclusion: Unless there is a little connection with other points, it will certainly meet the requirements.
Code:
1#include <cstdio>2#include <cstring>3#include <algorithm>4#include <queue>5 #defineInc (I,J,K) for (int i=j;i<=k;i++)6 #defineMAXN 2000107 using namespacestd;8 9InlineintRead () {Ten CharCh=getchar ();intf=1, x=0; One while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; Ch=GetChar ();} A while(ch>='0'&&ch<='9') x=x*Ten+ch-'0', ch=GetChar (); - returnf*x; - } the BOOLF[MAXN];intn,m; - intMain () { -N=read (); M=read (); Inc (I,1, m) {intX=read (), Y=read (); f[x]=f[y]=1;} -Inc (I,1, N)if(!f[i]) {Puts ("NIE");GotoEnd;} Puts"TAK"); +Endreturn 0; -}
20161107
bzoj2079[poi2010]guilds*