#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e9+900;
bool flag(int x, int y, int z) {
cout << y - x + 1 << ' ';
for (int i = x; i < y; ++i) {
cout << i + 1 << ' ';
}
cout << z + 1 << endl;
int h1;
cin >> h1;
cout << y - x << ' ';
for (int i = x; i < y; ++i) {
cout << i + 1 << ' ';
}
int h2;
cin >> h2;
return (h1 == h2);
}
int valueof(int x, int y, int z) {
if (!flag(x, y, z)) {
return maxx;
}
while (y - 1 > 1) {
int m = (x + y)/2;
if (flag(x, m, z)) {
y = m;
} else {
x = m;
}
}
return x;
}
vector<int> solve(int n) {
int v = 2;
vector<int> ans;
ans.push_back(1);
for (int i = 1; i < n; ++i) {
int j = valueof(0, i, i);
if (j == maxx) {
ans.push_back(v);
v++;
} else {
ans.push_back(ans[j]);
}
}
return ans;
}
int main() {
int n;
cin >> n;
vector<int> ans = solve(n);
cout << 0 << ' ';
for (int i = 0; i < n; ++i) {
cout << ans[i] << ' ';
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
280 KB |
Output is correct |
2 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
280 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |