Submission #534620

#TimeUsernameProblemLanguageResultExecution timeMemory
534620katwamiawCarnival (CEOI14_carnival)C++14
0 / 100
109 ms256 KiB
#include<bits/stdc++.h> #define ll long long using namespace std ; //fflush(stdout) ; const int max_n=159 ; int c[max_n] ; int main(){ int n ; cin >> n ; for(int i=1 ; i<=n ; i++) c[i]=-1 ; int r=1 ; for(int i=1 ; i<n ; i++){ for(int j=i+1 ; j<=n ; j++){ cout << "2 " << i << ' ' << j << '\n' ; fflush(stdout) ; int x ; cin >> x ; if(x==1){ if(c[i]==-1&&c[j]==-1){ c[i]=r ; c[j]=r ; r++ ; } else if(c[i]<c[j]){ c[i]=c[j] ; } else{ c[j]=c[i] ; } } else{ if(c[i]==-1&&c[j]==-1){ c[i]=r ; r++ ; c[j]=r ; r++ ; } else if(c[i]==-1){ c[i]=r ; r++ ; } else if(c[j]==-1){ c[j]=r ; r++ ; } } } } cout << 0 << ' ' ; for(int i=1 ; i<=n ; i++) cout << c[i] << ' ' ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...