#include <cstdio>
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
vector<int> M(N+5);
vector<int> res(N);
deque<int> curr;
curr.push_back(1);
M[0] = 1;
for(int i=1;i<N;i++){
M[i] = 1;
int q = Query(M);
if(q == 1){
curr.push_back(i+1);
break;
}
M[i] = 0;
}
/*
for(auto i:curr)cerr << i<<" ";
cerr<<'\n';
*/
int cnt = N-2;
while(cnt--){
int ind = 0;
for(int i=1;i<N;i++){
if(M[i] != 1){
M[i] = 1;
int q = Query(M);
if(q == 1){
ind = i;
break;
}
M[i] = 0;
}
}
//cout << ind << "\n";
M[curr.back()-1] = 0;
int q = Query(M);
M[curr.back()-1] = 1;
if(q == 2){
curr.push_back(ind+1);
}else curr.push_front(ind+1);
}/*
for(auto i:curr)cerr << i<<" ";
cerr<<'\n';
*/
res = vector<int>(curr.begin(),curr.end());
Answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |