#include<iostream>
using namespace std;
int n, i, nr, r, j;
int c[155], v[155];
void src(int st, int dr, int x){
if(st == dr){
c[x] = c[ v[st] ];
return;
}
int mid = (st + dr) / 2;
cout<< mid - st + 2 <<" ";
for(int i = st; i <= mid; i++){
cout<< v[i] <<" ";
}
cout<< x << endl;
cin>> r;
if(r == mid - st + 1){
src(st, mid, x);
}
else{
src(mid + 1, dr, x);
}
}
int main(){
cin>> n;
c[1] = v[1] = nr = 1;
for(i = 2; i <= n; i++){
cout<< nr + 1 <<" ";
for(j = 1; j <= nr; j++){
cout<< v[j] <<" ";
}
cout<< i << endl;
cin>> r;
if(r == nr + 1){
nr++;
v[nr] = i;
c[i] = nr;
}
else{
src(1, nr, i);
}
}
cout<<"0 ";
for(i = 1; i <= n; i++){
cout<< c[i] <<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
248 KB |
Output is correct |
2 |
Correct |
10 ms |
376 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
3 ms |
248 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
248 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
396 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
10 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
7 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
8 ms |
252 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
248 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
248 KB |
Output is correct |
6 |
Correct |
6 ms |
248 KB |
Output is correct |
7 |
Correct |
10 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
248 KB |
Output is correct |
2 |
Correct |
11 ms |
248 KB |
Output is correct |
3 |
Correct |
8 ms |
376 KB |
Output is correct |
4 |
Correct |
8 ms |
248 KB |
Output is correct |
5 |
Correct |
9 ms |
248 KB |
Output is correct |
6 |
Correct |
15 ms |
252 KB |
Output is correct |
7 |
Correct |
6 ms |
248 KB |
Output is correct |