#include<bits/stdc++.h>
using namespace std;
int get(int l, int r){
cout << r - l + 1 << " ";
for(int i = l; i <= r; i++){
cout << i << " ";
}
cout << endl;
int x;
cin >> x;
return x;
}
int main(){
int n;
cin >> n;
int a[n + 5], sz = 0;
memset(a, 0, sizeof(a));
for(int i = 1; i <= n; i++){
if(!a[i]){
a[i] = ++sz;
}
if(i == n){
break;
}
int l = i + 1, r = n;
while(r - l > 1){
int mid = (r + l) >> 1;
if(get(i + 1, mid) < get(i, mid)){
l = mid;
}
else{
r = mid;
}
}
if(get(i + 1, l) == get(i, l)){
a[l] = a[i];
}
else if(get(i + 1, r) == get(i, r)){
a[r] = a[i];
}
}
cout << "0 ";
for(int i = 1; i <= n; i++){
cout << a[i] << " ";
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
256 KB |
Output is correct |
2 |
Correct |
15 ms |
384 KB |
Output is correct |
3 |
Correct |
27 ms |
384 KB |
Output is correct |
4 |
Correct |
35 ms |
384 KB |
Output is correct |
5 |
Correct |
10 ms |
256 KB |
Output is correct |
6 |
Correct |
18 ms |
384 KB |
Output is correct |
7 |
Correct |
20 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
384 KB |
Output is correct |
2 |
Correct |
28 ms |
256 KB |
Output is correct |
3 |
Correct |
22 ms |
384 KB |
Output is correct |
4 |
Correct |
40 ms |
384 KB |
Output is correct |
5 |
Correct |
20 ms |
256 KB |
Output is correct |
6 |
Correct |
24 ms |
384 KB |
Output is correct |
7 |
Correct |
20 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
256 KB |
Output is correct |
2 |
Correct |
23 ms |
384 KB |
Output is correct |
3 |
Correct |
27 ms |
256 KB |
Output is correct |
4 |
Correct |
48 ms |
384 KB |
Output is correct |
5 |
Correct |
27 ms |
256 KB |
Output is correct |
6 |
Correct |
31 ms |
256 KB |
Output is correct |
7 |
Correct |
25 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
312 KB |
Output is correct |
2 |
Correct |
21 ms |
256 KB |
Output is correct |
3 |
Correct |
37 ms |
384 KB |
Output is correct |
4 |
Correct |
35 ms |
256 KB |
Output is correct |
5 |
Correct |
18 ms |
256 KB |
Output is correct |
6 |
Correct |
31 ms |
256 KB |
Output is correct |
7 |
Correct |
34 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
26 ms |
256 KB |
Output is correct |
3 |
Correct |
38 ms |
384 KB |
Output is correct |
4 |
Correct |
33 ms |
256 KB |
Output is correct |
5 |
Correct |
19 ms |
256 KB |
Output is correct |
6 |
Correct |
42 ms |
384 KB |
Output is correct |
7 |
Correct |
35 ms |
256 KB |
Output is correct |