#include <cstdio>
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
vector<int> M(N);
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(int t=2;t<N;t++){
for(int i=1;i<N;i++){
if(M[i] != 1){
M[i] = 1;
int q = Query(M);
if(q == 1){
M[curr.back()-1] = 0;
q = Query(M);
M[curr.back()-1] = 1;
if(q == 2){
curr.push_back(i+1);
}else{
curr.push_front(i+1);
}
break;
}
M[i] = 0;
}
}
}
for(auto i:curr)cerr<<i<<"\n";
res = vector<int>(curr.begin(),curr.end());
Answer(res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
272 KB |
# of queries: 8884 |
2 |
Correct |
178 ms |
276 KB |
# of queries: 8522 |
3 |
Correct |
171 ms |
200 KB |
# of queries: 8998 |
4 |
Correct |
183 ms |
276 KB |
# of queries: 9859 |
5 |
Correct |
190 ms |
276 KB |
# of queries: 10046 |
6 |
Correct |
166 ms |
276 KB |
# of queries: 9415 |
7 |
Correct |
122 ms |
200 KB |
# of queries: 9868 |
8 |
Correct |
203 ms |
276 KB |
# of queries: 9922 |
9 |
Correct |
208 ms |
280 KB |
# of queries: 9823 |
10 |
Correct |
64 ms |
284 KB |
# of queries: 4097 |
11 |
Correct |
1 ms |
200 KB |
# of queries: 0 |
12 |
Correct |
1 ms |
200 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
200 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
200 KB |
# of queries: 6 |
15 |
Correct |
3 ms |
200 KB |
# of queries: 88 |
16 |
Correct |
3 ms |
288 KB |
# of queries: 236 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
272 KB |
# of queries: 8884 |
2 |
Correct |
178 ms |
276 KB |
# of queries: 8522 |
3 |
Correct |
171 ms |
200 KB |
# of queries: 8998 |
4 |
Correct |
183 ms |
276 KB |
# of queries: 9859 |
5 |
Correct |
190 ms |
276 KB |
# of queries: 10046 |
6 |
Correct |
166 ms |
276 KB |
# of queries: 9415 |
7 |
Correct |
122 ms |
200 KB |
# of queries: 9868 |
8 |
Correct |
203 ms |
276 KB |
# of queries: 9922 |
9 |
Correct |
208 ms |
280 KB |
# of queries: 9823 |
10 |
Correct |
64 ms |
284 KB |
# of queries: 4097 |
11 |
Correct |
1 ms |
200 KB |
# of queries: 0 |
12 |
Correct |
1 ms |
200 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
200 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
200 KB |
# of queries: 6 |
15 |
Correct |
3 ms |
200 KB |
# of queries: 88 |
16 |
Correct |
3 ms |
288 KB |
# of queries: 236 |
17 |
Runtime error |
563 ms |
200 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |