#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define FOR(i, x, y) for(int i = x; i < y; i++)
typedef long long ll;
using namespace std;
int a[151];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, id = 1;
cin >> n;
vector<int> v;
FOR(i, 1, n + 1) {
cout << v.size() + 1 << ' ';
for (auto& j : v) cout << j << ' ';
cout << i << endl;
int x;
cin >> x;
if (x == v.size() + 1) {
a[i] = id++;
v.push_back(i);
} else {
int l = 0, r = v.size() - 1;
while (l != r) {
int mid = (l + r) / 2;
cout << mid - l + 2 << ' ' << i << ' ';
FOR(j, l, mid + 1) cout << v[j] << ' ';
cout << endl;
int k;
cin >> k;
if (k == mid - l + 2) r = mid;
else l = mid + 1;
}
a[i] = a[l];
}
}
cout << "0 ";
FOR(i, 1, n + 1) cout << a[i] << ' ';
cout << endl;
return 0;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:22:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (x == v.size() + 1) {
~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Integer 0 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
304 KB |
Integer 0 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer 0 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
Integer 0 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Integer 0 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |