# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867905 | Dec0Dedd | Art Collections (BOI22_art) | C++17 | 1241 ms | 1760 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;
// n <= 4 000
// q <= 4 000
void solve(int n) {
vector<int> tmp, v;
for (int i=1; i<=n; ++i) tmp.push_back(i);
int x=publish(tmp);
for (int i=1; i<=n; ++i) {
vector<int> k;
for (int j=1; j<=n; ++j) k.push_back(j);
k.erase(k.begin()+i-1), k.insert(k.begin(), i);
if (i > 1) v.push_back(i-1-(x-publish(k)+i-1)/2);
else v.push_back(0);
}
reverse(v.begin(), v.end());
for (int i=n-1; i>=0; --i) {
for (int j=i+1; j<n; ++j) {
if (v[i] <= v[j]) ++v[j];
}
}
for (int i=0; i<n; ++i) ++v[i];
reverse(v.begin(), v.end());
vector<int> ans(n, 0);
for (int i=0; i<n; ++i) ans[v[i]-1]=i+1;
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... |