# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
245624 | thecodingwizard | Swap (BOI16_swap) | C++11 | 1079 ms | 258112 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 <bits/stdc++.h>
using namespace std;
const int maxn = 200000;
int n, A[maxn+10];
vector<int> dp[maxn+10][36], tmp1, tmp2;
bool v[maxn+10][40];
void merge(vector<int> &res, int root, vector<int> &L, vector<int> &R) {
res.push_back(root);
for (int len = 1, i = 0, j = 0; i < L.size() || j < R.size(); i += len, j += len, len *= 2) {
for (int k = 0; k < len && i+k<L.size(); k++) res.push_back(L[i+k]);
for (int k = 0; k < len && i+k<R.size(); k++) res.push_back(R[i+k]);
}
}
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> n; for (int i = 1; i <= n; i++) cin >> A[i];
for (int i = 1; i <= n; i++) for (int j = 0; j < 36; j++) v[i][j] = false;
v[1][0] = 1;
for (int i = 1; 2*i+1 <= n; i++) {
for (int j = 0; j < 36; j++) {
if (!v[i][j]) continue;
int idx = i>>(j/2);
if (j&1) idx *= 2;
int cur = A[idx];
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... |