#include <iostream>
using namespace std;
const int MAXN = 155;
int counter = 1;
int arr[MAXN];
int maxsz;
int n;
void rec(int l,int r){
//cout<<l<<" "<<r<<endl;
if(l == r){
arr[l] = counter;
counter++;
if(counter>maxsz){
counter--;
}
return;
}
cout<<(r-l+1)<<" ";
for(int i=l;i<=r;i++){
cout<<i<<" ";
}
cout<<endl;
cout.flush();
int sz;
cin>>sz;
if(l == 1 && r == n){
maxsz = sz;
}
if(sz == (r-l+1)){
for(int i=l;i<=r;i++){
arr[i] = counter;
counter++;
if(counter>maxsz){
counter--;
}
}
return;
}
if(sz == 1){
for(int i=l;i<=r;i++){
arr[i] = counter;
}
counter++;
if(counter>maxsz){
counter--;
}
return;
}
int mid = (l+r)/2;
rec(l,mid);
rec(mid+1,r);
}
int main(){
cin>>n;
cout.flush();
rec(1,n);
cout<<0<<" ";
for(int i=1;i<=n;i++){
cout<<arr[i]<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |