#include "art.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int N) {
vector<int> df(N);
iota(df.begin(), df.end(), 1);
int k1 = publish(df);
vector<int> p(N);
for (int i = 1; i <= N; i++) {
vector<int> tmp = df;
tmp.erase(find(tmp.begin(), tmp.end(), i));
tmp.insert(tmp.end(), i);
int pos;
if (i < N) {
int k2 = publish(tmp);
pos = (k2-k1+N-i)/2;
} else pos = 0;
for (int j = 0; j < N; j++) {
if (p[j] != 0) continue;
if (pos == 0) {
p[j] = i;
break;
} else {
pos--;
}
}
}
reverse(p.begin(), p.end());
answer(p);
}
# | 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... |