Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bitset>
- #include <iostream>
- using namespace std;
- int m,n,a,b,t[200001],v=0;
- bitset <200005> prawda;
- void funkcja(int x,int y)
- {
- if(t[y]==1)
- {
- if(t[x]==2)
- t[x]=0;
- else
- t[x]=2;
- }
- else if(t[y]==2)
- {
- if(t[x]==1)
- t[x]=0;
- else
- t[x]=1;
- }
- else
- {
- t[x]=2;}
- }
- int main() {
- cin>>n>>m;
- for(int i=0;m!=i;i++)
- {
- cin>>a>>b;
- if(t[a]==0)
- funkcja(a,b);
- if(t[b]==0)
- funkcja(b,a);
- prawda[a]=1;
- prawda[b]=1;
- }
- for(int i=1;n>=i;i++)
- {
- if(prawda[i]==0)
- {
- v=1;
- cout<<"NIE";
- break;
- }
- }
- if(v==0)
- {
- cout<<"TAK"<<endl;
- for(int i=1;n>=i;i++)
- {
- if(t[i]==0)
- cout<<"N\n";
- else if(t[i]==1)
- cout<<"K\n";
- else
- cout<<"S\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement