# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962141 | lotusblume | 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 <iostream>
#include <vector>
#include "art.h"
void solve(int n)
std::vector<int> p(n);
for (int i = 0; i < n; ++i) {
p[i] = i + 1;
}
int orig = publish(p);
std::vector<int> ans(n, 0);
for (int i = 0; i < n - 1; ++i) {
for (int j = 0; j < i; ++j) {
p[j] = j + 1;
}
for (int j = i; j < n - 1; ++j) {
p[j] = j + 2;
}
p[n - 1] = i + 1;
int dif = orig - publish(p);
int x = ((n - i - 1) + dif) / 2;
for (int j = 0; j < n; ++j) {
if (ans[j] == 0) {
if (x == 0) {
ans[j] = i + 1;
break;
}
else {
--x;
}
}
}
}
for (int j = 0; j < n; ++j) {
if (ans[j] == 0) {
ans[j] = n;
break;
}
}
answer(ans);
}