# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
426374 | duality | The Collection Game (BOI21_swaps) | C++14 | 7 ms | 456 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;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#include "swaps.h"
void solve(int N,int V) {
int i,j,k,l;
vi order;
for (i = 1; i <= N; i++) order.pb(i);
for (i = 1; i <= N; i *= 2) {
for (j = i; j >= 1; j /= 2) {
vpii v;
for (k = j % i; k < N-j; k += 2*j) {
for (l = 0; l < j; l++) {
if (j+k+l >= N) break;
if ((k+l)/(2*i) == (j+k+l)/(2*i)) v.pb(mp(k+l,j+k+l));
}
}
for (k = 0; k < v.size(); k++) schedule(order[v[k].first],order[v[k].second]);
vi r = visit();
for (k = 0; k < v.size(); k++) {
if (!r[k]) swap(order[v[k].first],order[v[k].second]);
}
}
}
answer(order);
}
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... |