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;
using i64 = long long;
#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
#define rep(i, n) L(i, 1, n)
#define all(x) x.begin(),x.end()
#define me(x,a) memset(x,a,sizeof(x))
#include<random>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include "swaps.h"
const int nax = 505;
int a[nax];
void odd_even(int N,int V) {
if (N == 1) {
answer({ 1 });
return;
}
L(i, 1, N) a[i] = i;
int par = 0;
for (int t = 0; t < N; t++) {
int st = 1 + (par == 1);
vector<pair<int,int>> q;
for (int i = st; i + 1 <= N; i += 2) {
schedule(a[i], a[i + 1]);
q.push_back(make_pair(i, i + 1));
}
vector<int> res = visit();
for (int i = 0; i < (int)res.size(); i++) {
if (res[i] == 0) {
swap(a[q[i].first], a[q[i].second]);
}
}
par ^= 1;
}
vector<int> ans;
L(i, 1, N) ans.push_back(a[i]);
answer(ans);
return;
}
void solve(int N, int V) {
odd_even(N, V);
return;
}
# | 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... |