#include <bits/stdc++.h>
using namespace std;
int pai[155];
int cor[155];
void tenta(int i,int l,int r){
if(l==r){
if(l==i)return;
cout<<2<<" "<<i<<" "<<l<<endl;
int x;
cin>>x;
if(x==1)cor[l] = cor[i];
return;
}else{
int m = (l+r)/2;
if(l!=m){
cout<<m-l+1;
for(int i=l;i<=m;i++)cout<<" "<<i;
cout<<endl;
int x;
cin>>x;
cout<<m-l+2<<" "<<i;
for(int i=l;i<=m;i++)cout<<" "<<i;
cout<<endl;
int y;
cin>>y;
if(x==y){
tenta(i,l,m);
}
}else tenta(i,l,l);
if(r!=m+1){
cout<<r-(m+1) + 1;
for(int i=m+1;i<=r;i++)cout<<" "<<i;
cout<<endl;
int x;
cin>>x;
cout<<r-(m+1) + 2 <<" "<<i;
for(int i=m+1;i<=r;i++)cout<<" "<<i;
cout<<endl;
int y;
cin>>y;
if(x==y){
// cout<<l<<" "<<r<<"-> "<<m+1<<" "<<r<<endl;
tenta(i,m+1,r);
}
}else tenta(i,r,r);
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)cor[i] = -1;
int cur=1;
for(int i=1;i<n;i++){
if(cor[i]!=-1)continue;
cor[i] = cur;
tenta(i,i+1,n);
cur++;
}
cout<<0;
for(int i=1;i<=n;i++)cout<<" "<<cor[i];
cout<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
376 KB |
Output is correct |
2 |
Correct |
22 ms |
248 KB |
Output is correct |
3 |
Incorrect |
15 ms |
248 KB |
Integer -1 violates the range [1, 100] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
248 KB |
Output is correct |
2 |
Correct |
13 ms |
248 KB |
Output is correct |
3 |
Incorrect |
12 ms |
252 KB |
Integer -1 violates the range [1, 79] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
248 KB |
Output is correct |
2 |
Correct |
22 ms |
248 KB |
Output is correct |
3 |
Correct |
13 ms |
248 KB |
Output is correct |
4 |
Incorrect |
12 ms |
376 KB |
Integer -1 violates the range [1, 141] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
248 KB |
Output is correct |
2 |
Correct |
19 ms |
248 KB |
Output is correct |
3 |
Correct |
16 ms |
376 KB |
Output is correct |
4 |
Incorrect |
9 ms |
248 KB |
Integer -1 violates the range [1, 146] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
376 KB |
Output is correct |
2 |
Correct |
23 ms |
376 KB |
Output is correct |
3 |
Incorrect |
19 ms |
376 KB |
Integer -1 violates the range [1, 89] |
4 |
Halted |
0 ms |
0 KB |
- |