# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114784 |
2019-06-02T16:44:59 Z |
maruii |
Library (JOI18_library) |
C++14 |
|
526 ms |
384 KB |
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N)
{
vector<int> vec(N), res(N);
for (int i = 0, pre; i < N; ++i) {
int l = 0, r = N - 1;
while (l < r) {
int m = l + r >> 1;
int t, a, b;
vector<int> v = vec;
fill(v.begin() + l, v.begin() + m + 1, 1);
a = Query(v);
if (i == 0) {
for (auto &j: v) j ^= 1;
if (accumulate(v.begin(), v.end(), 0)) b = Query(v);
else b = 0;
t = a >= b;
}
else {
v[pre] = 0;
if (accumulate(v.begin(), v.end(), 0)) b = Query(v);
else b = 0;
if (i == 1) t = a == b;
else t = a < b;
}
if (t) r = m;
else l = m + 1;
}
vec[l] = 1;
pre = l;
res[i] = l + 1;
}
Answer(res);
}
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:11:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int m = l + r >> 1;
~~^~~
library.cpp:23:10: warning: 'pre' may be used uninitialized in this function [-Wmaybe-uninitialized]
v[pre] = 0;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
384 KB |
# of queries: 2944 |
2 |
Correct |
49 ms |
384 KB |
# of queries: 2926 |
3 |
Correct |
54 ms |
384 KB |
# of queries: 3088 |
4 |
Correct |
35 ms |
256 KB |
# of queries: 3088 |
5 |
Correct |
35 ms |
256 KB |
# of queries: 3088 |
6 |
Correct |
28 ms |
256 KB |
# of queries: 3088 |
7 |
Correct |
28 ms |
384 KB |
# of queries: 3088 |
8 |
Correct |
39 ms |
256 KB |
# of queries: 2962 |
9 |
Correct |
36 ms |
384 KB |
# of queries: 3070 |
10 |
Correct |
38 ms |
256 KB |
# of queries: 1810 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
384 KB |
# of queries: 3 |
13 |
Correct |
2 ms |
256 KB |
# of queries: 10 |
14 |
Correct |
2 ms |
256 KB |
# of queries: 16 |
15 |
Correct |
3 ms |
256 KB |
# of queries: 118 |
16 |
Correct |
5 ms |
384 KB |
# of queries: 260 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
384 KB |
# of queries: 2944 |
2 |
Correct |
49 ms |
384 KB |
# of queries: 2926 |
3 |
Correct |
54 ms |
384 KB |
# of queries: 3088 |
4 |
Correct |
35 ms |
256 KB |
# of queries: 3088 |
5 |
Correct |
35 ms |
256 KB |
# of queries: 3088 |
6 |
Correct |
28 ms |
256 KB |
# of queries: 3088 |
7 |
Correct |
28 ms |
384 KB |
# of queries: 3088 |
8 |
Correct |
39 ms |
256 KB |
# of queries: 2962 |
9 |
Correct |
36 ms |
384 KB |
# of queries: 3070 |
10 |
Correct |
38 ms |
256 KB |
# of queries: 1810 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
384 KB |
# of queries: 3 |
13 |
Correct |
2 ms |
256 KB |
# of queries: 10 |
14 |
Correct |
2 ms |
256 KB |
# of queries: 16 |
15 |
Correct |
3 ms |
256 KB |
# of queries: 118 |
16 |
Correct |
5 ms |
384 KB |
# of queries: 260 |
17 |
Correct |
458 ms |
384 KB |
# of queries: 19952 |
18 |
Correct |
404 ms |
312 KB |
# of queries: 19710 |
19 |
Correct |
526 ms |
384 KB |
# of queries: 19952 |
20 |
Correct |
436 ms |
256 KB |
# of queries: 18676 |
21 |
Correct |
417 ms |
256 KB |
# of queries: 17598 |
22 |
Correct |
437 ms |
256 KB |
# of queries: 19952 |
23 |
Correct |
418 ms |
256 KB |
# of queries: 19930 |
24 |
Correct |
176 ms |
384 KB |
# of queries: 9238 |
25 |
Correct |
410 ms |
256 KB |
# of queries: 19490 |
26 |
Correct |
389 ms |
384 KB |
# of queries: 18258 |
27 |
Correct |
147 ms |
384 KB |
# of queries: 9196 |
28 |
Correct |
510 ms |
384 KB |
# of queries: 19951 |
29 |
Correct |
440 ms |
256 KB |
# of queries: 19929 |
30 |
Correct |
436 ms |
384 KB |
# of queries: 19951 |