#include <bits/stdc++.h>
#include "library.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
int query(vector<int> t){
bool yes = false;
for(auto p : t) yes |= (p > 0);
if(!yes) return 0;
return Query(t);
}
void Solve(int n){
if(n==1){
Answer({1});
return;
}
if(n == 2){
Answer({1,2});
return;
}
vector<int> p(n);
vector<int> answ;
for(int i = 0 ; i < n; i ++ )
p[i] = 1;
int las;
for(int i = 0 ; i < n; i ++ ){
p[i]=0;
if(query(p) == 1){
answ.push_back(i);
break;
}
p[i]=1;
}
int lf, rf, md;
int cur, nx;
for(int i = 1 ; i < n; i ++ ){
las = answ.back();
lf = 0;
rf = n-1;
while(lf < rf){
md = (lf + rf) / 2;
for(int t = 0 ;t < n; t ++ )
p[t] = 0;
for(int t = 0 ; t <= md; t ++ )
p[t] = 1;
for(auto v : answ)
p[v] = 0;
cur = query(p);
p[las] = 1;
nx = query(p);
if(cur == nx){
rf = md;
}
else{
lf = md + 1;
}
}
answ.push_back(rf);
}
for(int i = 0 ; i < n ; i ++ )
answ[i] ++ ;
Answer(answ);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
248 KB |
# of queries: 2928 |
2 |
Correct |
55 ms |
248 KB |
# of queries: 2963 |
3 |
Correct |
61 ms |
248 KB |
# of queries: 3205 |
4 |
Correct |
61 ms |
248 KB |
# of queries: 3151 |
5 |
Correct |
62 ms |
376 KB |
# of queries: 3058 |
6 |
Correct |
58 ms |
376 KB |
# of queries: 3113 |
7 |
Correct |
57 ms |
248 KB |
# of queries: 3120 |
8 |
Correct |
59 ms |
376 KB |
# of queries: 2961 |
9 |
Correct |
57 ms |
316 KB |
# of queries: 3096 |
10 |
Correct |
49 ms |
248 KB |
# of queries: 1816 |
11 |
Correct |
2 ms |
376 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
296 KB |
# of queries: 0 |
13 |
Correct |
2 ms |
248 KB |
# of queries: 7 |
14 |
Correct |
2 ms |
376 KB |
# of queries: 10 |
15 |
Correct |
3 ms |
248 KB |
# of queries: 106 |
16 |
Correct |
6 ms |
248 KB |
# of queries: 249 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
248 KB |
# of queries: 2928 |
2 |
Correct |
55 ms |
248 KB |
# of queries: 2963 |
3 |
Correct |
61 ms |
248 KB |
# of queries: 3205 |
4 |
Correct |
61 ms |
248 KB |
# of queries: 3151 |
5 |
Correct |
62 ms |
376 KB |
# of queries: 3058 |
6 |
Correct |
58 ms |
376 KB |
# of queries: 3113 |
7 |
Correct |
57 ms |
248 KB |
# of queries: 3120 |
8 |
Correct |
59 ms |
376 KB |
# of queries: 2961 |
9 |
Correct |
57 ms |
316 KB |
# of queries: 3096 |
10 |
Correct |
49 ms |
248 KB |
# of queries: 1816 |
11 |
Correct |
2 ms |
376 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
296 KB |
# of queries: 0 |
13 |
Correct |
2 ms |
248 KB |
# of queries: 7 |
14 |
Correct |
2 ms |
376 KB |
# of queries: 10 |
15 |
Correct |
3 ms |
248 KB |
# of queries: 106 |
16 |
Correct |
6 ms |
248 KB |
# of queries: 249 |
17 |
Incorrect |
631 ms |
408 KB |
Wrong Answer [3] |
18 |
Correct |
537 ms |
376 KB |
# of queries: 19987 |
19 |
Incorrect |
575 ms |
376 KB |
Wrong Answer [3] |
20 |
Correct |
574 ms |
276 KB |
# of queries: 18929 |
21 |
Correct |
547 ms |
376 KB |
# of queries: 17844 |
22 |
Incorrect |
644 ms |
248 KB |
Wrong Answer [3] |
23 |
Correct |
614 ms |
504 KB |
# of queries: 19978 |
24 |
Correct |
221 ms |
248 KB |
# of queries: 9271 |
25 |
Correct |
610 ms |
248 KB |
# of queries: 19826 |
26 |
Correct |
529 ms |
248 KB |
# of queries: 18585 |
27 |
Correct |
195 ms |
376 KB |
# of queries: 9408 |
28 |
Correct |
451 ms |
376 KB |
# of queries: 15001 |
29 |
Correct |
482 ms |
248 KB |
# of queries: 14987 |
30 |
Correct |
443 ms |
376 KB |
# of queries: 15001 |