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;
int Query(const std::vector<int> &p);
void Answer(int a, int b);
void Solve(int N) {
int n = N;
vector<bool> visited(2*n+1);
for(int i=1;i<=2*n;i++){
if(visited[i])continue;
visited[i]=true;
int ans = 1;
for(int jump=512;jump;jump/=2){
if(ans+jump>2*n)continue;
vector<int> q;
for(int j=1;j<ans+jump;j++)if(!visited[j])q.emplace_back(j);
auto base = Query(q);
q.emplace_back(i);
if(Query(q)!=base)ans+=jump;
}
visited[ans]=true;
Answer(i,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... |