This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |