#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 |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
20 ms |
456 KB |
Output is correct |
4 |
Correct |
19 ms |
344 KB |
Output is correct |
5 |
Correct |
19 ms |
456 KB |
Output is correct |
6 |
Correct |
18 ms |
344 KB |
Output is correct |
7 |
Correct |
19 ms |
344 KB |
Output is correct |
8 |
Correct |
19 ms |
456 KB |
Output is correct |
9 |
Correct |
19 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
20 ms |
456 KB |
Output is correct |
4 |
Correct |
19 ms |
344 KB |
Output is correct |
5 |
Correct |
19 ms |
456 KB |
Output is correct |
6 |
Correct |
18 ms |
344 KB |
Output is correct |
7 |
Correct |
19 ms |
344 KB |
Output is correct |
8 |
Correct |
19 ms |
456 KB |
Output is correct |
9 |
Correct |
19 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [6] |
12 |
Halted |
0 ms |
0 KB |
- |