# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
909810 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 4 ms | 496 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>
using namespace std;
using ll = long long;
vector <ll> ans;
int main () {
ll n;
cin >> n;
ans.resize(n);
vector <ll> diff;
diff.push_back(0);
ll curColor = 0;
ans[0] = curColor++;
for (ll i = 1; i < n; i++) {
cout << diff.size()+1 << ' ';
for (ll j : diff) cout << j+1 << ' ';
cout << i+1 << '\n';
ll res;
cin >> res;
if (res == diff.size()+1) {
diff.push_back(i);
ans[i] = curColor++;
continue;
}
ll l = 0, r = diff.size();
while (l+1 < r) {
ll mid = (l+r)>>1;
cout << mid+1 << ' ';
for (ll j = 0; j < mid; j++) cout << diff[j]+1 << ' ';
cout << i+1 << '\n';
ll res;
cin >> res;
if (res == mid) {
r = mid;
} else {
l = mid;
}
}
ans[i] = ans[diff[l]];
}
cout << "0 ";
for (ll i : ans) cout << i+1 << ' ';
cout << '\n';
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... |