# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026426 | gyg | Art Collections (BOI22_art) | C++17 | 934 ms | 1916 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 "art.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 4e3 + 5;
int n;
array<int, MAX_N> pos;
void move(vector<int>& x) {
assert(x.size());
int y = x[0];
x.erase(x.begin());
x.push_back(y);
}
void solve(int _n) {
n = _n;
vector<int> list;
for (int i = 1; i <= n; i++) list.push_back(i);
int prev = publish(list);
for (int i = 1; i < n; i++) {
move(list);
int cur = publish(list);
pos[i] = (prev - cur + n - 1) / 2 + 1;
prev = cur;
}
unordered_set<int> vals;
for (int i = 1; i <= n; i++)
if (pos[i] != 0) vals.insert(pos[i]);
for (int i = 1; i <= n; i++) {
if (pos[i] != 0) continue;
for (int j = 1; j <= n; j++)
if (!vals.count(j)) pos[i] = j;
}
vector<int> ans(n);
for (int i = 1; i <= n; i++) ans[pos[i] - 1] = i;
answer(ans);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |