# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
995036 |
2024-06-08T11:11:54 Z |
pera |
Library (JOI18_library) |
C++17 |
|
236 ms |
680 KB |
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
if(N == 1){
return Answer({1});
}
vector<int> ans , e(N) , tx(N);
for(int i = 0;i < N;i ++){
tx[i] = e[i] = 1;
}
int L = -1;
for(int i = 0;i < N;i ++){
tx[i] = 0;
if(Query(tx) == 1){
L = i;
break;
}
tx[i] = 1;
}
e[L] = 0;
ans.push_back(L);
for(int r = 1;r < N;r ++){
int pos = 0;
for(int bit = 9;bit >= 0;bit --){
int _pos = pos + (1 << bit);
if(_pos <= N - r){
vector<int> u(N);
for(int i = 0;i < N;i ++){
if(_pos > 0 && e[i]){
--_pos;
u[i] = 1;
}
}
int bef = Query(u);
u[ans.back()] = 1;
int now = Query(u);
if(bef != now){
pos += (1 << bit);
}
}
}
++pos;
for(int i = 0;i < N;i ++){
if(e[i]){
--pos;
}
if(pos == 0){
pos = i;
break;
}
}
ans.push_back(pos);
e[pos] = 0;
}
for(int i = 0;i < N;i ++){
++ans[i];
}
Answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
344 KB |
# of queries: 2507 |
2 |
Correct |
22 ms |
344 KB |
# of queries: 2505 |
3 |
Correct |
20 ms |
344 KB |
# of queries: 2770 |
4 |
Correct |
28 ms |
344 KB |
# of queries: 2695 |
5 |
Correct |
25 ms |
344 KB |
# of queries: 2602 |
6 |
Correct |
34 ms |
344 KB |
# of queries: 2675 |
7 |
Correct |
28 ms |
344 KB |
# of queries: 2698 |
8 |
Correct |
26 ms |
344 KB |
# of queries: 2544 |
9 |
Correct |
27 ms |
344 KB |
# of queries: 2660 |
10 |
Correct |
11 ms |
344 KB |
# of queries: 1566 |
11 |
Correct |
0 ms |
344 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 3 |
13 |
Correct |
0 ms |
344 KB |
# of queries: 8 |
14 |
Correct |
0 ms |
344 KB |
# of queries: 11 |
15 |
Correct |
1 ms |
344 KB |
# of queries: 89 |
16 |
Correct |
2 ms |
344 KB |
# of queries: 213 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
344 KB |
# of queries: 2507 |
2 |
Correct |
22 ms |
344 KB |
# of queries: 2505 |
3 |
Correct |
20 ms |
344 KB |
# of queries: 2770 |
4 |
Correct |
28 ms |
344 KB |
# of queries: 2695 |
5 |
Correct |
25 ms |
344 KB |
# of queries: 2602 |
6 |
Correct |
34 ms |
344 KB |
# of queries: 2675 |
7 |
Correct |
28 ms |
344 KB |
# of queries: 2698 |
8 |
Correct |
26 ms |
344 KB |
# of queries: 2544 |
9 |
Correct |
27 ms |
344 KB |
# of queries: 2660 |
10 |
Correct |
11 ms |
344 KB |
# of queries: 1566 |
11 |
Correct |
0 ms |
344 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 3 |
13 |
Correct |
0 ms |
344 KB |
# of queries: 8 |
14 |
Correct |
0 ms |
344 KB |
# of queries: 11 |
15 |
Correct |
1 ms |
344 KB |
# of queries: 89 |
16 |
Correct |
2 ms |
344 KB |
# of queries: 213 |
17 |
Correct |
236 ms |
440 KB |
# of queries: 18516 |
18 |
Correct |
213 ms |
420 KB |
# of queries: 17631 |
19 |
Correct |
214 ms |
592 KB |
# of queries: 17883 |
20 |
Correct |
196 ms |
428 KB |
# of queries: 16717 |
21 |
Correct |
172 ms |
428 KB |
# of queries: 15814 |
22 |
Correct |
226 ms |
428 KB |
# of queries: 18067 |
23 |
Correct |
223 ms |
428 KB |
# of queries: 17622 |
24 |
Correct |
93 ms |
344 KB |
# of queries: 8145 |
25 |
Correct |
210 ms |
424 KB |
# of queries: 17542 |
26 |
Correct |
204 ms |
680 KB |
# of queries: 16391 |
27 |
Correct |
101 ms |
424 KB |
# of queries: 8268 |
28 |
Correct |
202 ms |
428 KB |
# of queries: 17955 |
29 |
Correct |
226 ms |
428 KB |
# of queries: 17935 |
30 |
Correct |
206 ms |
432 KB |
# of queries: 17955 |