#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, C = 0; cin >> N;
vector<int> costume(N + 1, -1);
for(int i = 1; i <= N; i++) {
if(costume[i] == -1) {
C++;
costume[i] = C;
}
int l = i + 1, r = N, mid, pos = N + 1;
while(l <= r) {
mid = (l + r) / 2;
cout << (mid - i + 1);
for(int j = i; j <= mid; j++) {
cout << ' ' << j;
}
cout << '\n';
cout.flush();
int a; cin >> a;
cout << (mid - i);
for(int j = i + 1; j <= mid; j++) {
cout << ' ' << j;
}
cout << '\n';
cout.flush();
int b; cin >> b;
if(a == b) {
pos = min(pos, mid);
r = mid - 1;
} else {
l = mid + 1;
}
}
if(pos != N + 1) {
costume[pos] = costume[i];
}
}
cout << 0;
for(int i = 1; i <= N; i++) {
cout << ' ' << costume[i];
}
cout << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
208 KB |
Output is correct |
2 |
Correct |
18 ms |
208 KB |
Output is correct |
3 |
Correct |
23 ms |
208 KB |
Output is correct |
4 |
Correct |
27 ms |
208 KB |
Output is correct |
5 |
Correct |
15 ms |
208 KB |
Output is correct |
6 |
Correct |
15 ms |
208 KB |
Output is correct |
7 |
Correct |
24 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
208 KB |
Output is correct |
2 |
Correct |
16 ms |
208 KB |
Output is correct |
3 |
Correct |
14 ms |
208 KB |
Output is correct |
4 |
Correct |
23 ms |
208 KB |
Output is correct |
5 |
Correct |
13 ms |
208 KB |
Output is correct |
6 |
Correct |
15 ms |
208 KB |
Output is correct |
7 |
Correct |
17 ms |
276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
208 KB |
Output is correct |
2 |
Correct |
14 ms |
208 KB |
Output is correct |
3 |
Correct |
18 ms |
208 KB |
Output is correct |
4 |
Correct |
22 ms |
208 KB |
Output is correct |
5 |
Correct |
17 ms |
208 KB |
Output is correct |
6 |
Correct |
17 ms |
208 KB |
Output is correct |
7 |
Correct |
21 ms |
300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
208 KB |
Output is correct |
2 |
Correct |
17 ms |
208 KB |
Output is correct |
3 |
Correct |
24 ms |
208 KB |
Output is correct |
4 |
Correct |
28 ms |
208 KB |
Output is correct |
5 |
Correct |
16 ms |
208 KB |
Output is correct |
6 |
Correct |
20 ms |
208 KB |
Output is correct |
7 |
Correct |
19 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
208 KB |
Output is correct |
2 |
Correct |
20 ms |
208 KB |
Output is correct |
3 |
Correct |
16 ms |
208 KB |
Output is correct |
4 |
Correct |
23 ms |
208 KB |
Output is correct |
5 |
Correct |
19 ms |
208 KB |
Output is correct |
6 |
Correct |
20 ms |
208 KB |
Output is correct |
7 |
Correct |
22 ms |
208 KB |
Output is correct |