# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114781 |
2019-06-02T16:37:22 Z |
maruii |
Library (JOI18_library) |
C++14 |
|
487 ms |
384 KB |
#include <cstdio>
#include <vector>
#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;
b = Query(v);
t = a >= b;
}
else {
v[pre] = 0;
b = Query(v);
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:12: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 |
36 ms |
384 KB |
# of queries: 2944 |
2 |
Correct |
28 ms |
384 KB |
# of queries: 2926 |
3 |
Correct |
51 ms |
256 KB |
# of queries: 3088 |
4 |
Correct |
49 ms |
384 KB |
# of queries: 3088 |
5 |
Correct |
53 ms |
384 KB |
# of queries: 3088 |
6 |
Correct |
48 ms |
384 KB |
# of queries: 3088 |
7 |
Correct |
51 ms |
256 KB |
# of queries: 3088 |
8 |
Correct |
36 ms |
256 KB |
# of queries: 2962 |
9 |
Correct |
50 ms |
384 KB |
# of queries: 3070 |
10 |
Correct |
16 ms |
256 KB |
# of queries: 1810 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [2] |
13 |
Correct |
2 ms |
256 KB |
# of queries: 10 |
14 |
Correct |
3 ms |
384 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 |
36 ms |
384 KB |
# of queries: 2944 |
2 |
Correct |
28 ms |
384 KB |
# of queries: 2926 |
3 |
Correct |
51 ms |
256 KB |
# of queries: 3088 |
4 |
Correct |
49 ms |
384 KB |
# of queries: 3088 |
5 |
Correct |
53 ms |
384 KB |
# of queries: 3088 |
6 |
Correct |
48 ms |
384 KB |
# of queries: 3088 |
7 |
Correct |
51 ms |
256 KB |
# of queries: 3088 |
8 |
Correct |
36 ms |
256 KB |
# of queries: 2962 |
9 |
Correct |
50 ms |
384 KB |
# of queries: 3070 |
10 |
Correct |
16 ms |
256 KB |
# of queries: 1810 |
11 |
Correct |
2 ms |
256 KB |
# of queries: 0 |
12 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [2] |
13 |
Correct |
2 ms |
256 KB |
# of queries: 10 |
14 |
Correct |
3 ms |
384 KB |
# of queries: 16 |
15 |
Correct |
3 ms |
256 KB |
# of queries: 118 |
16 |
Correct |
5 ms |
384 KB |
# of queries: 260 |
17 |
Correct |
487 ms |
384 KB |
# of queries: 19952 |
18 |
Correct |
481 ms |
384 KB |
# of queries: 19710 |
19 |
Correct |
469 ms |
256 KB |
# of queries: 19952 |
20 |
Correct |
458 ms |
384 KB |
# of queries: 18676 |
21 |
Correct |
462 ms |
380 KB |
# of queries: 17598 |
22 |
Correct |
461 ms |
256 KB |
# of queries: 19952 |
23 |
Correct |
476 ms |
256 KB |
# of queries: 19930 |
24 |
Correct |
158 ms |
256 KB |
# of queries: 9238 |
25 |
Correct |
467 ms |
256 KB |
# of queries: 19490 |
26 |
Correct |
458 ms |
384 KB |
# of queries: 18258 |
27 |
Correct |
183 ms |
384 KB |
# of queries: 9196 |
28 |
Incorrect |
194 ms |
256 KB |
Wrong Answer [2] |
29 |
Incorrect |
195 ms |
384 KB |
Wrong Answer [2] |
30 |
Incorrect |
195 ms |
256 KB |
Wrong Answer [2] |