# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121247 | 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>
#include "art.h"
using namespace std;
vector <int> v;
vector <int> ans(4444);
// int publish(vector <int> v) {
// cout << "publish({";
// int x;
// for(auto to : v) cout << to << " ";
// cout << "})" << endl;
// cin >> x;
// return x;
// }
// void answer(vector <int> v) {
// cout << "answer({";
// for(auto to : v) {if(to != 0) cout << to << " ";}
// cout << "})" << endl;
// }
void solve() {
int n;
cin >> n;
vector <int> v, v2;
for(int i = 1; i <= n; i++) {
v.push_back(i);
}
int res = publish(v);
if(res == 0) {
answer(v);
return;
}
v.clear();
int ind = 1;
//cout << res << '\n';
for(int i = 1; i < n; i++) {
vector <int> v2;
//cout << i << endl;
for(int j = i + 1; j <= n; j++) {
v2.push_back(j);
}
for(int j = 1; j <= i; j++) {
v2.push_back(j);
}
int cur = publish(v2);
int A = res, B = cur;
int d = (A + B - n + 1) / 2;
ans[A - d + 1] = i;
//cout << i << " " << A << " " << B << " " << d << " " << A - d + 1 << " " << endl;
v = v2;
res = cur;
}
for(int i = 1; i < n; i++) {
if(ans[i] == 0) ans[i] = n;
}
answer(ans);
}
// signed main() {
// solve();
// }