# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
666989 | berr | Art Collections (BOI22_art) | C++17 | 1475 ms | 576 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>
using namespace std;
#include "art.h"
void solve(int n)
{
vector<int> ans(n), val1(n), val2(n);
vector<int> a(n);
for(int i=0; i<n; i++) a[i]=i+1;
reverse(a.begin(), a.begin()+n-1);
int pos=1;
while(val1[a[n-1]-1]==0)
{
reverse(a.begin(), a.begin()+n-1);
int k=publish(a);
val1[a[n-1]-1]=k;
reverse(a.begin(), a.end());
int p=(n*(n-1))/2-k;
val2[a[n-1]-1]=p;
}
for(int i=0; i<n; i++)
{
int h=val1[i]+val2[i]-((n-1)*(n-2))/2;
h/=2;
ans[h]=i+1;
}
reverse(ans.begin(), ans.end());
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... |