# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74446 | shoemakerjo | Carnival (CEOI14_carnival) | C++14 | 10 ms | 584 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;
#define maxn 155
int N;
int ans[maxn];
vector<int> oq;
int query(vector<int> stuff, int val) {
cout << stuff.size() + 1 << " ";
for (int vv : stuff) cout << vv << " ";
cout << val << endl;
int ss ;
cin >> ss;
return ss;
}
int main() {
cin >> N;
ans[1] = 1;
oq.push_back(1);
for (int i = 2; i <= N; i++) {
int cur = query(oq, i);
if (cur == oq.size()+1) {
ans[i] = oq.size()+1;
oq.push_back(i);
continue;
}
int l = 0;
int r= oq.size()-1;
while (l != r) {
int mid = (l+r)/2;
vector<int> vc;
for (int i = l; i <= mid; i++) {
vc.push_back(oq[i]);
}
int cans = query(vc, i);
if (cans == vc.size()) { //match is in here
r = mid;
}
else {
l = mid+1;
}
}
// cout << i << " " << "l: " << l << endl;
ans[i] = ans[oq[l]];
}
cout << 0;
for (int i = 1; i <= N; i++) {
cout << " " << ans[i];
}
cout << endl;
}
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... |