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>cur;
vector<int>ans;
for(int i=1;i<=n;i++)cur.push_back(i);
for(int i=1;i<n;i++){
vector<int>v = cur;
while(sz(v)>1){
vector<int>nw;
int m = sz(v);
for(int j=0;j+1<m;j+=2)schedule(v[j],v[j+1]);
vector<int>res = visit();
int c = 0;
for(int j=0;j+1<m;j+=2){
if(res[c])nw.push_back(v[j+1]);
else nw.push_back(v[j]);
c++;
}
if(m&1)nw.push_back(v.back());
v = nw;
}
ans.push_back(v.back());
v.clear();
for(int x:cur){
if(x!=ans.back())v.push_back(x);
}
cur = v;
}
ans.push_back(cur.back());
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... |