#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int n)
{
vector<int> res(n);
vector<int> ask(n , 1);
int pre = 0;
vector<int> p(n);
for(int i = 0 ; i < n ; ++i)p[i] = i;
auto del = [&](int x){
p.erase(find(p.begin(),p.end(),x));
};
for(int i = 0 ; i < n ; ++i){
ask[i] = 0;
if(Query(ask) == 1){
pre = i;
break;
}
}
del(pre);res[0] = pre;
for(int i = 1 ; i < n ; ++i){
int l = 0 , h = (int)p.size() - 1;
while(l <= h){
fill(ask.begin(),ask.end(),0);
int mid = l + h >> 1;
for(int j = 0 ; j <= mid ; ++j)ask[p[j]] = 1;
int last = Query(ask);
ask[pre] = 1;
if(last == Query(ask))h = mid - 1;
else l = mid + 1;
}
pre = p[l];
del(pre);
res[i] = pre;
}
for(int i = 0 ; i < n ; ++i)res[i]++;
Answer(res);
}
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:27:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int mid = l + h >> 1;
~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
7 ms |
680 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Incorrect |
34 ms |
376 KB |
Wrong Answer [8] |
3 |
Runtime error |
47 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
6 ms |
444 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Incorrect |
51 ms |
248 KB |
Wrong Answer [8] |
6 |
Incorrect |
49 ms |
248 KB |
Wrong Answer [8] |
7 |
Runtime error |
10 ms |
552 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Incorrect |
46 ms |
248 KB |
Wrong Answer [8] |
9 |
Incorrect |
35 ms |
304 KB |
Wrong Answer [8] |
10 |
Runtime error |
17 ms |
444 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [2] |
12 |
Correct |
2 ms |
376 KB |
# of queries: 3 |
13 |
Correct |
2 ms |
376 KB |
# of queries: 6 |
14 |
Correct |
2 ms |
248 KB |
# of queries: 9 |
15 |
Correct |
3 ms |
248 KB |
# of queries: 79 |
16 |
Runtime error |
3 ms |
552 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
7 ms |
680 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Incorrect |
34 ms |
376 KB |
Wrong Answer [8] |
3 |
Runtime error |
47 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
6 ms |
444 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Incorrect |
51 ms |
248 KB |
Wrong Answer [8] |
6 |
Incorrect |
49 ms |
248 KB |
Wrong Answer [8] |
7 |
Runtime error |
10 ms |
552 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Incorrect |
46 ms |
248 KB |
Wrong Answer [8] |
9 |
Incorrect |
35 ms |
304 KB |
Wrong Answer [8] |
10 |
Runtime error |
17 ms |
444 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [2] |
12 |
Correct |
2 ms |
376 KB |
# of queries: 3 |
13 |
Correct |
2 ms |
376 KB |
# of queries: 6 |
14 |
Correct |
2 ms |
248 KB |
# of queries: 9 |
15 |
Correct |
3 ms |
248 KB |
# of queries: 79 |
16 |
Runtime error |
3 ms |
552 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
488 ms |
452 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
323 ms |
456 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Incorrect |
502 ms |
376 KB |
Wrong Answer [8] |
20 |
Runtime error |
160 ms |
452 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
21 |
Runtime error |
364 ms |
452 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
22 |
Runtime error |
335 ms |
460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
23 |
Incorrect |
527 ms |
248 KB |
Wrong Answer [8] |
24 |
Runtime error |
32 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
25 |
Incorrect |
439 ms |
376 KB |
Wrong Answer [8] |
26 |
Runtime error |
380 ms |
460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
27 |
Runtime error |
139 ms |
636 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Correct |
373 ms |
248 KB |
# of queries: 15975 |
29 |
Correct |
373 ms |
376 KB |
# of queries: 15957 |
30 |
Correct |
429 ms |
376 KB |
# of queries: 15975 |