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>
#define sz(a) (int)(a.size())
using namespace std;
void solve(int n,int V){
vector<int>ans;
for(int i=1;i<=n;i++)ans.push_back(i);
for(int i=0;i<n;i++){
int c = 0;
if(i&1){
for(int j=0;j+1<n;j+=2)schedule(ans[j],ans[j+1]);
vector<int>res = visit();
for(int j=0;j+1<n;j+=2){
if(res[c])swap(ans[j],ans[j+1]);
c++;
}
}else{
for(int j=1;j+1<n;j+=2)schedule(ans[j],ans[j+1]);
vector<int>res = visit();
for(int j=1;j+1<n;j+=2){
if(res[c])swap(ans[j],ans[j+1]);
c++;
}
}
}
reverse(ans.begin(),ans.end());
answer(ans);
}
# | 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... |