# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
877662 | vjudge1 | Art Collections (BOI22_art) | C++17 | 1092 ms | 1804 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 <algorithm>
using namespace std;
void solve(int n) {
vector <int> order;
for (int i = 1; i <= n; i++) order.push_back(i);
int res[n + 1];
for (int i = 0; i < n; i++) {
res[i] = publish(order);
order.push_back(order[0]);
order.erase(order.begin());
}
res[n] = res[0];
for (int i = 0; i < n; i++) {
// res[i] = z + x
// res[i + 1] = z + n - 1 - x
// res[i] + res[i + 1] = 2z + n - 1
int z = (res[i] + res[i + 1] - n + 1) / 2;
int x = res[i] - z;
order[x] = i + 1;
}
answer(order);
}
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... |