# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
93837 |
2019-01-12T09:56:09 Z |
alexpetrescu |
Cave (IOI13_cave) |
C++14 |
|
2000 ms |
568 KB |
#include "cave.h"
#define MAXN 5000
#define LOGN 12
int s[MAXN], d[MAXN];
bool done[MAXN];
inline bool vezi(int a, bool k, int u, int n) {
for (int i = 0; i <= a; i++)
if (done[i] == 0)
s[i] = k;
for (int i = a + 1; i < n; i++)
if (done[i] == 0)
s[i] = 1 - k;
bool ans = tryCombination(s) == u;
for (int i = 0; i < n; i++)
if (done[i] == 0)
s[i] = 0;
return ans;
}
void exploreCave(int n) {
for (int i = 0; i < n; i++) {
bool k = tryCombination(s) == i;
int rez = -1;
for (int pas = 1 << LOGN; pas; pas >>= 1)
if (rez + pas < n - 1 && vezi(rez + pas, k, i, n))
rez += pas;
rez++;
d[rez] = i;
s[rez] = k;
done[rez] = 1;
}
answer(s, d);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
630 ms |
448 KB |
Output is correct |
2 |
Correct |
700 ms |
440 KB |
Output is correct |
3 |
Correct |
1270 ms |
448 KB |
Output is correct |
4 |
Correct |
810 ms |
432 KB |
Output is correct |
5 |
Correct |
922 ms |
444 KB |
Output is correct |
6 |
Correct |
878 ms |
452 KB |
Output is correct |
7 |
Correct |
963 ms |
444 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
940 ms |
448 KB |
Output is correct |
13 |
Correct |
911 ms |
508 KB |
Output is correct |
14 |
Correct |
917 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
974 ms |
440 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
1142 ms |
556 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
1065 ms |
448 KB |
Output is correct |
7 |
Correct |
941 ms |
568 KB |
Output is correct |
8 |
Execution timed out |
2062 ms |
384 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
288 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
360 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
432 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
360 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
288 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
360 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
432 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
360 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
256 KB |
Output is correct |
15 |
Correct |
6 ms |
256 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
256 KB |
Output is correct |
19 |
Correct |
6 ms |
432 KB |
Output is correct |
20 |
Correct |
139 ms |
384 KB |
Output is correct |
21 |
Correct |
6 ms |
256 KB |
Output is correct |
22 |
Correct |
6 ms |
256 KB |
Output is correct |
23 |
Correct |
372 ms |
404 KB |
Output is correct |
24 |
Correct |
378 ms |
408 KB |
Output is correct |
25 |
Correct |
401 ms |
404 KB |
Output is correct |
26 |
Correct |
6 ms |
280 KB |
Output is correct |
27 |
Correct |
5 ms |
256 KB |
Output is correct |
28 |
Correct |
162 ms |
528 KB |
Output is correct |
29 |
Correct |
6 ms |
384 KB |
Output is correct |
30 |
Correct |
204 ms |
404 KB |
Output is correct |
31 |
Correct |
175 ms |
400 KB |
Output is correct |
32 |
Correct |
6 ms |
256 KB |
Output is correct |
33 |
Correct |
6 ms |
256 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
301 ms |
384 KB |
Output is correct |
36 |
Correct |
308 ms |
408 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
630 ms |
448 KB |
Output is correct |
2 |
Correct |
700 ms |
440 KB |
Output is correct |
3 |
Correct |
1270 ms |
448 KB |
Output is correct |
4 |
Correct |
810 ms |
432 KB |
Output is correct |
5 |
Correct |
922 ms |
444 KB |
Output is correct |
6 |
Correct |
878 ms |
452 KB |
Output is correct |
7 |
Correct |
963 ms |
444 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
940 ms |
448 KB |
Output is correct |
13 |
Correct |
911 ms |
508 KB |
Output is correct |
14 |
Correct |
917 ms |
460 KB |
Output is correct |
15 |
Correct |
974 ms |
440 KB |
Output is correct |
16 |
Correct |
5 ms |
256 KB |
Output is correct |
17 |
Correct |
1142 ms |
556 KB |
Output is correct |
18 |
Correct |
5 ms |
256 KB |
Output is correct |
19 |
Correct |
5 ms |
256 KB |
Output is correct |
20 |
Correct |
1065 ms |
448 KB |
Output is correct |
21 |
Correct |
941 ms |
568 KB |
Output is correct |
22 |
Execution timed out |
2062 ms |
384 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |