# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
545251 | Jomnoi | Carnival (CEOI14_carnival) | C++17 | 9 ms | 320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;
const int N = 160;
int n, l, r, pos, mid, res, prv, now;
int ans[N];
vector <int> vec;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i = 1; i <= n; i++) {
cout << i << ' ';
for(int j = 1; j <= i; j++) {
cout << j << ' ';
}
cout << endl;
cin >> now;
if(now != prv) {
vec.push_back(i);
ans[i] = now;
prv = now;
continue;
}
l = 0, r = vec.size() - 1, pos;
while(l <= r) {
mid = (l + r) / 2;
cout << mid + 2 << ' ';
for(int i = 0; i <= mid; i++) {
cout << vec[i] << ' ';
}
cout << i << endl;
cin >> res;
if(res < mid + 2) {
r = mid - 1;
pos = mid;
}
else {
l = mid + 1;
}
}
ans[i] = ans[vec[pos]];
}
for(int i = 0; i <= n; i++) {
cout << ans[i] << ' ';
}
cout << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |