# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56899 | ainta | Swap (BOI16_swap) | C++17 | 497 ms | 90160 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<cstdio>
#include<algorithm>
#include<vector>
#define SZ 262144
using namespace std;
int w[262144], n, res[262144], R[262144];
vector<int>P[262144], D[262144], U[262144];
int Get(int nd, int x) {
int t = lower_bound(P[nd].begin(), P[nd].end(), x + 1) - P[nd].begin();
if (t == 0)return nd;
return D[nd][t - 1];
}
int Get2(int nd, int x) {
if (x == 0)return nd;
return D[nd][x - 1];
}
int A[262144], B[262144];
void Do(int a) {
if (a * 2 >= 262144) {
R[a] = a;
return;
}
int c1 = a * 2, c2 = a * 2 + 1;
Do(c1);
Do(c2);
int CA = 0, CB = 0;
for (auto &t : P[c1]) if (t < w[c1])A[CA++] = t;
A[CA++] = w[c1];
for (auto &t : P[c1]) if (t > w[c1])A[CA++] = t;
for (auto &t : P[c2]) if (t < w[c2])B[CB++] = t;
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... |