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 "swaps.h"
#include <vector>
#include <algorithm>
#include <cstdio>
#define X first
#define Y second
#define PB push_back
#define EB emplace_back
using namespace std;
typedef vector < int > vi;
typedef pair < int, int > pii;
void solve(int n, int v) {
int lg2 = 8;
vector < int > P;
vector < pii > tko;
for(int i = 1;i <= n;i++) P.PB(i);
for(int i = 0;i <= lg2;i++){
for(int j = i;j >= 0;j--){
for(int k = 0;k < n;k++){
if(i != j && (k & (1 << j))){
tko.EB(k ^ (1 << j), k);
schedule(P[tko.back().X], P[tko.back().Y]);
}
if(i == j && (k ^ ((1 << (j + 1)) - 1)) < k){
tko.EB(k ^ ((1 << (j + 1)) - 1), k);
schedule(P[tko.back().X], P[tko.back().Y]);
}
}
vi odg = visit();
for(int i = 0;i < (int)odg.size();i++)
if(!odg[i]) swap(P[tko[i].X], P[tko[i].Y]);
tko.clear();
}
}
answer(P);
}
# | 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... |