# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
721628 | drdilyor | Art Collections (BOI22_art) | C++17 | 1 ms | 208 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;
void solve(int n) {
vector<int> ans(n);
iota(ans.begin(), ans.end(), 1);
for (int i = 1; i <= n;i++) {
auto cur = ans;
cur.erase(find(cur.begin(), cur.end(), i));
cur.push_back(i);
int mn = 1e9, mni = -1;
for (int j = n-1; j >= 0; j--) {
int inv = publish(cur);
if (inv <mn) {
mn = inv;
mni = j;
}
if (j) swap(cur[j], cur[j-1]);
}
int r = find(ans.begin(), ans.end(), i) - ans.begin();
if (r != mni)
swap(ans[r], ans[mni]);
}
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... |