#include <cstdio>
#include <vector>
#include "library.h"
#include<bits/stdc++.h>
using namespace std;
int adj[1005][2],st=0;
void Solve(int n){
vector<int> res;
if(n == 1){
res.push_back(1);
Answer(res);
return;
}
vector<int> M(n), K, K2;
K = M;
for(int i=1;i<=n;i++) K[i-1] = 1;
for(int i=1;i<=n;i++){
K[i-1] = 0;
if(Query(K) == 1){
st = i;
break;
}
K[i-1] = 1;
}
int pos = st,pre = -1;
for(int i=1;i<=n;i++){
// printf(">> %d %d\n",pos,pre);
res.push_back(pos);
int be = 1, ed = n, mid, mi = 1e9, keep = pos;
while(be <= ed){
mid = (be+ed)/2;
K = M;
for(int j=1;j<=mid;j++) if(j != pre) K[j-1] = 1;
K2 = K;
K[pos-1] = 1, K2[pos-1] = 0;
int A;
if(K2 == M) A = 0;
else A = Query(K2);
if(Query(K) <= A){
ed = mid - 1;
mi = min(mi,mid);
}
else be = mid + 1;
}
pos = mi;
pre = keep;
}
Answer(res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
208 KB |
# of queries: 2963 |
2 |
Correct |
41 ms |
208 KB |
# of queries: 2997 |
3 |
Correct |
34 ms |
308 KB |
# of queries: 3232 |
4 |
Correct |
48 ms |
208 KB |
# of queries: 3183 |
5 |
Correct |
43 ms |
208 KB |
# of queries: 3096 |
6 |
Correct |
43 ms |
208 KB |
# of queries: 3143 |
7 |
Correct |
42 ms |
208 KB |
# of queries: 3152 |
8 |
Correct |
44 ms |
208 KB |
# of queries: 2994 |
9 |
Correct |
45 ms |
208 KB |
# of queries: 3124 |
10 |
Correct |
24 ms |
208 KB |
# of queries: 1848 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 6 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 13 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 20 |
15 |
Correct |
2 ms |
208 KB |
# of queries: 121 |
16 |
Correct |
4 ms |
208 KB |
# of queries: 271 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
208 KB |
# of queries: 2963 |
2 |
Correct |
41 ms |
208 KB |
# of queries: 2997 |
3 |
Correct |
34 ms |
308 KB |
# of queries: 3232 |
4 |
Correct |
48 ms |
208 KB |
# of queries: 3183 |
5 |
Correct |
43 ms |
208 KB |
# of queries: 3096 |
6 |
Correct |
43 ms |
208 KB |
# of queries: 3143 |
7 |
Correct |
42 ms |
208 KB |
# of queries: 3152 |
8 |
Correct |
44 ms |
208 KB |
# of queries: 2994 |
9 |
Correct |
45 ms |
208 KB |
# of queries: 3124 |
10 |
Correct |
24 ms |
208 KB |
# of queries: 1848 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 6 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 13 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 20 |
15 |
Correct |
2 ms |
208 KB |
# of queries: 121 |
16 |
Correct |
4 ms |
208 KB |
# of queries: 271 |
17 |
Runtime error |
455 ms |
428 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |