# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
573629 | pavement | Art Collections (BOI22_art) | C++17 | 1716 ms | 580 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;
#define pb push_back
void solve(int N) {
int _ord[2 * N + 1], *ord = _ord + N;
memset(_ord, -1, sizeof _ord);
ord[0] = 1;
vector<int> order, out;
for (int i = 1; i <= N; i++) order.pb(i);
int E = publish(order);
for (int i = 2, pos = 0; i <= N; i++) {
int tmp = -1;
if (i & 1) {
swap(order[pos], order[(i - 1) / 2]);
tmp = order[pos];
pos = (i - 1) / 2;
} else {
swap(order[pos], order[order.size() - i / 2]);
tmp = order[pos];
pos = order.size() - i / 2;
}
int E2 = publish(order), D = E2 - E;
if (i & 1) D = -D;
int dist = (D > 0 ? (D + 1) / 2 : -(-D + 1) / 2);
if (dist > 0) {
int pos = 0;
while (dist) {
if (ord[pos] == -1) dist--;
pos++;
}
ord[pos - 1] = tmp;
} else {
int pos = 0;
while (dist) {
if (ord[pos] == -1) dist++;
pos--;
}
ord[pos + 1] = tmp;
}
E = E2;
}
for (int i = -N; i <= N; i++)
if (ord[i] != -1) out.pb(ord[i]);
answer(out);
}
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... |