# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937558 | LucaIlie | Art Collections (BOI22_art) | C++17 | 1249 ms | 1672 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 <bits/stdc++.h>
using namespace std;
void solve( int n ) {
vector<int> p( n ), q( n ), ans( n );
vector<bool> vis( n + 1 );
for ( int i = 0; i < n; i++ )
p[i] = i + 1;
int inv = publish( p );
for ( int x = n; x >= 1; x-- ) {
q[0] = x;
for ( int i = 1; i < x; i++ )
q[i] = i;
for ( int i = x; i < n; i++ )
q[i] = i + 1;
int dif = publish( q ) - inv;
int sum = x - 1;
int l = (dif + sum) / 2;
for ( int y = 1; y <= n; y++ ) {
if ( !vis[y] ) {
if ( l == 0 ) {
ans[y - 1] = x;
vis[y] = true;
break;
}
l--;
}
}
}
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... |