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;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
void solve(int n, int q) {
vector<int> ord;
for(int i = 0 ; i < n; i ++ )
ord.push_back(i + 1);
int cc;
for(int go = 0; go < n; go ++ ){
if(go % 2 == 0){
for(int i = 0 ; i + 1 < n; i += 2){
schedule(ord[i], ord[i + 1]);
}
vector<int> cha = visit();
cc = 0;
for(int i = 0; i + 1 < n; i += 2){
if(cha[cc] == 0) swap(ord[i], ord[i + 1]);
cc ++ ;
}
}
else{
for(int i = 1 ; i + 1 < n; i += 2){
schedule(ord[i], ord[i + 1]);
}
vector<int> cha = visit();
cc = 0;
for(int i = 1; i + 1 < n; i += 2){
if(cha[cc] == 0) swap(ord[i], ord[i + 1]);
cc ++ ;
}
}
}
answer(ord);
}
# | 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... |