# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597555 | boris_mihov | Art Collections (BOI22_art) | C++17 | 1842 ms | 640 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 <numeric>
#include <iostream>
std::vector < int > perm, ans;
void solve(int n)
{
perm.resize(n);
ans.reserve(n);
std::iota(perm.begin(), perm.end(), 1);
int lastInv = publish(perm), currInv;
ans.push_back(n);
for (int i = n-2 ; i >= 0 ; --i)
{
perm.erase(perm.begin() + i);
perm.push_back(i + 1);
currInv = publish(perm);
int bigger = (currInv - lastInv + (n - i - 1)) / 2;
ans.insert(ans.end() - bigger, i + 1);
lastInv = currInv;
}
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... |