# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
715922 | ismayil | 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 "art.h"
#include<bits/stdc++.h>
using namespace std;
// g++ -std=c++17 art_sample.cpp sample_grader.cpp
int n;
int f(){
vector<int> order;
for (int i = 1; i <= n; i++)
{
order.push_back(i);
}
return publish(order);
}
int f_inv(int a){
vector<int> order;
for (int i = 1; i <= n; i++)
{
if(i == a) continue;
order.push_back(i);
}
order.push_back(a);
return publish(order);
}
int cell[4001];
void solve(int N) {
n = N;
vector<int> ans(n, 0);
int inv = f();
for (int i = 1; i <= n; i++)
{
int ninv = f_inv(i);
/*
inv = x + y + pos(i);
ninv = n - i - pos(i) + x + y;
inv - ninv = pos(i) - n + i + pos(i)
2 * pos(i) = inv - ninv + n - i
*/
int pos = (inv - ninv + n - i) / 2;
//cout << i << " " << pos << endl;
for(int j = 0; j < 5; j++){
if(cell[j] == 0 && pos == 0){
ans[j] = i;
cell[j] = 1;
break;
}
if(cell[j] == 0) pos--;
}
}
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... |