# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1009883 | thangdz2k7 | The Collection Game (BOI21_swaps) | C++17 | 4 ms | 1572 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>
#include "swaps.h"
using namespace std;
vector <int> ans;
void solve(int n, int v){
for (int i = 1; i <= n; ++ i) ans.push_back(i);
for (int t = 0; t < 9; ++ t){
for (int k = t; k >= 0; -- k){
vector <pair <int, int>> ask;
for (int i = 0; i < n; ++ i){
if (((i >> k) & 1) != (k - t != 0)) continue;
if (i + (1 << k) >= n) continue;
if ((i + (1 << k) >> (t + 1)) != (i >> (t + 1))) continue;
schedule(ans[i], ans[i + (1 << k)]);
ask.push_back({i, i + (1 << k)});
}
vector <int> res = visit();
for (int i = 0; i < res.size(); ++ i){
if (!res[i]) swap(ans[ask[i].first], ans[ask[i].second]);
}
}
}
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... |
# | 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... |