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 <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
void schedule(int, int);
vector<int> visit();
void answer(std::vector<int>);
vector<int> B;
void solve(int N, int V){
for(int i = 1; i <= N; ++i) B.pb(i);
for(int i = 0; i < 500; ++i){
if(i&1){
for(int j = 2; j < N; j += 2) schedule(B[j - 1], B[j]);
}else{
for(int j = 1; j < N; j += 2) schedule(B[j - 1], B[j]);
}
vector<int> vv = visit();
if(i&1){
for(int j = 2, k = 0; j < N; j += 2, ++k) if(!vv[k]) swap(B[j - 1], B[j]);
}else{
for(int j = 1, k = 0; j < N; j += 2, ++k) if(!vv[k]) swap(B[j - 1], B[j]);
}
}
answer(B);
}
# | 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... |