#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++){
res.push_back(pos);
if(i == n) break;
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 |
47 ms |
208 KB |
# of queries: 2947 |
2 |
Correct |
50 ms |
208 KB |
# of queries: 2981 |
3 |
Correct |
52 ms |
208 KB |
# of queries: 3216 |
4 |
Correct |
65 ms |
208 KB |
# of queries: 3167 |
5 |
Correct |
32 ms |
208 KB |
# of queries: 3080 |
6 |
Correct |
36 ms |
208 KB |
# of queries: 3127 |
7 |
Correct |
42 ms |
300 KB |
# of queries: 3136 |
8 |
Correct |
58 ms |
208 KB |
# of queries: 2978 |
9 |
Correct |
30 ms |
304 KB |
# of queries: 3108 |
10 |
Correct |
24 ms |
300 KB |
# of queries: 1832 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 4 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 9 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 14 |
15 |
Correct |
1 ms |
208 KB |
# of queries: 113 |
16 |
Correct |
3 ms |
208 KB |
# of queries: 261 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
208 KB |
# of queries: 2947 |
2 |
Correct |
50 ms |
208 KB |
# of queries: 2981 |
3 |
Correct |
52 ms |
208 KB |
# of queries: 3216 |
4 |
Correct |
65 ms |
208 KB |
# of queries: 3167 |
5 |
Correct |
32 ms |
208 KB |
# of queries: 3080 |
6 |
Correct |
36 ms |
208 KB |
# of queries: 3127 |
7 |
Correct |
42 ms |
300 KB |
# of queries: 3136 |
8 |
Correct |
58 ms |
208 KB |
# of queries: 2978 |
9 |
Correct |
30 ms |
304 KB |
# of queries: 3108 |
10 |
Correct |
24 ms |
300 KB |
# of queries: 1832 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 4 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 9 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 14 |
15 |
Correct |
1 ms |
208 KB |
# of queries: 113 |
16 |
Correct |
3 ms |
208 KB |
# of queries: 261 |
17 |
Runtime error |
392 ms |
300 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |