# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120152 | vjudge1 | Art Collections (BOI22_art) | C++17 | 0 ms | 0 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;
void solve(int n) {
vector<int> p;
for(int i = 1; i <= n; i++) {
p.push_back(i);
}
int cur = publish(p);
vector<int> ans(n, -1);
for(int i = 0; i < n - 1; i++) {
reverse(p.begin(), p.end());
int d = p.back();
p.pop_back();
reverse(p.begin(), p.end());
p.push_back(d);
int cur2 = publish(p);
//a - b = cur - cur2;
//a + b = n - 1
//2 * a = cur - cur2 + n - 1;
int a = (cur - cur2 + n - 1)/2;
ans[a] = d;
cur = cur2;
}
int pos = 0;
for(int i = 0; i < n; i++) {
if(ans[i] == -1) {
ans[i] = p[0];
}
}
answer(ans);
}