# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
207776 |
2020-03-08T22:38:11 Z |
mode149256 |
Cave (IOI13_cave) |
C++14 |
|
463 ms |
640 KB |
#include "cave.h"
#include <bits/stdc++.h>
void exploreCave(int N) {
int *ans = new int[N];
int *D = new int[N];
// 00001111
for (int i = 0; i < N; ++i)
ans[i] = -1;
auto print = [&](int *vec) {
for (int i = 0; i < N; ++i)
printf("%d ", vec[i]);
printf("\n");
};
auto bandyk = [&](int *vec) {
int ret = tryCombination(vec);
return ret == -1 ? N : ret;
};
for (int h = 0; h < N; ++h)
{
int *A = new int[N];
for (int j = 0; j < N; ++j)
{
if (ans[j] == -1) A[j] = 1;
else A[j] = ans[j];
}
int manoCorrect = int(bandyk(A) > h);
// printf("ats = %d, bandau: ", manoCorrect); print(A);
int l = 0, r = N - 1;
while (l < r) {
int m = (l + r) / 2;
for (int i = l; i <= r; ++i)
if (ans[i] == -1)
A[i] = int(m < i);
int ans = (bandyk(A) > h);
// printf("l = %d, r = %d, ats = %d, bandau: ",
// l, r, ans); print(A);
if (ans ^ manoCorrect ) {
r = m;
} else
l = m + 1;
}
ans[l] = manoCorrect;
D[l] = h;
// printf("h = %d, l = %d, manoCorrect %d\n", h, l, manoCorrect);
delete[] A;
}
answer(ans, D);
}
Compilation message
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:11:7: warning: variable 'print' set but not used [-Wunused-but-set-variable]
auto print = [&](int *vec) {
^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
496 KB |
Output is correct |
2 |
Correct |
137 ms |
544 KB |
Output is correct |
3 |
Correct |
400 ms |
512 KB |
Output is correct |
4 |
Correct |
200 ms |
384 KB |
Output is correct |
5 |
Correct |
389 ms |
524 KB |
Output is correct |
6 |
Correct |
282 ms |
508 KB |
Output is correct |
7 |
Correct |
285 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
7 ms |
384 KB |
Output is correct |
12 |
Correct |
212 ms |
632 KB |
Output is correct |
13 |
Correct |
208 ms |
504 KB |
Output is correct |
14 |
Correct |
262 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
520 KB |
Output is correct |
2 |
Correct |
5 ms |
512 KB |
Output is correct |
3 |
Correct |
285 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
331 ms |
504 KB |
Output is correct |
7 |
Correct |
347 ms |
508 KB |
Output is correct |
8 |
Correct |
383 ms |
516 KB |
Output is correct |
9 |
Correct |
415 ms |
512 KB |
Output is correct |
10 |
Correct |
444 ms |
512 KB |
Output is correct |
11 |
Correct |
313 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
452 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
6 ms |
512 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
6 ms |
512 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
512 KB |
Output is correct |
13 |
Correct |
5 ms |
396 KB |
Output is correct |
14 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
452 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
6 ms |
512 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
6 ms |
512 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
512 KB |
Output is correct |
13 |
Correct |
5 ms |
396 KB |
Output is correct |
14 |
Correct |
6 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
512 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
42 ms |
384 KB |
Output is correct |
21 |
Correct |
6 ms |
396 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
63 ms |
584 KB |
Output is correct |
24 |
Correct |
68 ms |
384 KB |
Output is correct |
25 |
Correct |
61 ms |
460 KB |
Output is correct |
26 |
Correct |
5 ms |
512 KB |
Output is correct |
27 |
Correct |
6 ms |
384 KB |
Output is correct |
28 |
Correct |
58 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
512 KB |
Output is correct |
30 |
Correct |
38 ms |
384 KB |
Output is correct |
31 |
Correct |
39 ms |
448 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
6 ms |
460 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
65 ms |
512 KB |
Output is correct |
36 |
Correct |
76 ms |
512 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
496 KB |
Output is correct |
2 |
Correct |
137 ms |
544 KB |
Output is correct |
3 |
Correct |
400 ms |
512 KB |
Output is correct |
4 |
Correct |
200 ms |
384 KB |
Output is correct |
5 |
Correct |
389 ms |
524 KB |
Output is correct |
6 |
Correct |
282 ms |
508 KB |
Output is correct |
7 |
Correct |
285 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
11 |
Correct |
7 ms |
384 KB |
Output is correct |
12 |
Correct |
212 ms |
632 KB |
Output is correct |
13 |
Correct |
208 ms |
504 KB |
Output is correct |
14 |
Correct |
262 ms |
516 KB |
Output is correct |
15 |
Correct |
222 ms |
520 KB |
Output is correct |
16 |
Correct |
5 ms |
512 KB |
Output is correct |
17 |
Correct |
285 ms |
504 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
331 ms |
504 KB |
Output is correct |
21 |
Correct |
347 ms |
508 KB |
Output is correct |
22 |
Correct |
383 ms |
516 KB |
Output is correct |
23 |
Correct |
415 ms |
512 KB |
Output is correct |
24 |
Correct |
444 ms |
512 KB |
Output is correct |
25 |
Correct |
313 ms |
500 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
6 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
452 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
512 KB |
Output is correct |
31 |
Correct |
6 ms |
512 KB |
Output is correct |
32 |
Correct |
6 ms |
512 KB |
Output is correct |
33 |
Correct |
6 ms |
512 KB |
Output is correct |
34 |
Correct |
6 ms |
512 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
6 ms |
384 KB |
Output is correct |
37 |
Correct |
6 ms |
512 KB |
Output is correct |
38 |
Correct |
5 ms |
396 KB |
Output is correct |
39 |
Correct |
6 ms |
384 KB |
Output is correct |
40 |
Correct |
5 ms |
384 KB |
Output is correct |
41 |
Correct |
5 ms |
512 KB |
Output is correct |
42 |
Correct |
6 ms |
384 KB |
Output is correct |
43 |
Correct |
6 ms |
384 KB |
Output is correct |
44 |
Correct |
5 ms |
384 KB |
Output is correct |
45 |
Correct |
42 ms |
384 KB |
Output is correct |
46 |
Correct |
6 ms |
396 KB |
Output is correct |
47 |
Correct |
5 ms |
384 KB |
Output is correct |
48 |
Correct |
63 ms |
584 KB |
Output is correct |
49 |
Correct |
68 ms |
384 KB |
Output is correct |
50 |
Correct |
61 ms |
460 KB |
Output is correct |
51 |
Correct |
5 ms |
512 KB |
Output is correct |
52 |
Correct |
6 ms |
384 KB |
Output is correct |
53 |
Correct |
58 ms |
384 KB |
Output is correct |
54 |
Correct |
5 ms |
512 KB |
Output is correct |
55 |
Correct |
38 ms |
384 KB |
Output is correct |
56 |
Correct |
39 ms |
448 KB |
Output is correct |
57 |
Correct |
5 ms |
384 KB |
Output is correct |
58 |
Correct |
6 ms |
460 KB |
Output is correct |
59 |
Correct |
5 ms |
384 KB |
Output is correct |
60 |
Correct |
65 ms |
512 KB |
Output is correct |
61 |
Correct |
76 ms |
512 KB |
Output is correct |
62 |
Correct |
5 ms |
384 KB |
Output is correct |
63 |
Correct |
155 ms |
496 KB |
Output is correct |
64 |
Correct |
160 ms |
384 KB |
Output is correct |
65 |
Correct |
290 ms |
500 KB |
Output is correct |
66 |
Correct |
237 ms |
496 KB |
Output is correct |
67 |
Correct |
212 ms |
504 KB |
Output is correct |
68 |
Correct |
241 ms |
508 KB |
Output is correct |
69 |
Correct |
240 ms |
516 KB |
Output is correct |
70 |
Correct |
6 ms |
384 KB |
Output is correct |
71 |
Correct |
5 ms |
512 KB |
Output is correct |
72 |
Correct |
246 ms |
508 KB |
Output is correct |
73 |
Correct |
223 ms |
516 KB |
Output is correct |
74 |
Correct |
249 ms |
516 KB |
Output is correct |
75 |
Correct |
252 ms |
580 KB |
Output is correct |
76 |
Correct |
5 ms |
384 KB |
Output is correct |
77 |
Correct |
5 ms |
384 KB |
Output is correct |
78 |
Correct |
251 ms |
512 KB |
Output is correct |
79 |
Correct |
326 ms |
504 KB |
Output is correct |
80 |
Correct |
436 ms |
524 KB |
Output is correct |
81 |
Correct |
397 ms |
524 KB |
Output is correct |
82 |
Correct |
435 ms |
452 KB |
Output is correct |
83 |
Correct |
283 ms |
504 KB |
Output is correct |
84 |
Correct |
5 ms |
384 KB |
Output is correct |
85 |
Correct |
45 ms |
384 KB |
Output is correct |
86 |
Correct |
223 ms |
528 KB |
Output is correct |
87 |
Correct |
6 ms |
460 KB |
Output is correct |
88 |
Correct |
5 ms |
384 KB |
Output is correct |
89 |
Correct |
63 ms |
464 KB |
Output is correct |
90 |
Correct |
67 ms |
384 KB |
Output is correct |
91 |
Correct |
74 ms |
456 KB |
Output is correct |
92 |
Correct |
408 ms |
512 KB |
Output is correct |
93 |
Correct |
393 ms |
516 KB |
Output is correct |
94 |
Correct |
384 ms |
640 KB |
Output is correct |
95 |
Correct |
6 ms |
512 KB |
Output is correct |
96 |
Correct |
6 ms |
384 KB |
Output is correct |
97 |
Correct |
340 ms |
508 KB |
Output is correct |
98 |
Correct |
36 ms |
512 KB |
Output is correct |
99 |
Correct |
287 ms |
516 KB |
Output is correct |
100 |
Correct |
5 ms |
512 KB |
Output is correct |
101 |
Correct |
40 ms |
452 KB |
Output is correct |
102 |
Correct |
51 ms |
584 KB |
Output is correct |
103 |
Correct |
253 ms |
512 KB |
Output is correct |
104 |
Correct |
5 ms |
512 KB |
Output is correct |
105 |
Correct |
5 ms |
384 KB |
Output is correct |
106 |
Correct |
6 ms |
512 KB |
Output is correct |
107 |
Correct |
76 ms |
448 KB |
Output is correct |
108 |
Correct |
85 ms |
452 KB |
Output is correct |
109 |
Correct |
400 ms |
512 KB |
Output is correct |
110 |
Correct |
463 ms |
532 KB |
Output is correct |
111 |
Correct |
6 ms |
384 KB |
Output is correct |