Submission #485350

# Submission time Handle Problem Language Result Execution time Memory
485350 2021-11-07T08:18:54 Z silverfish Cave (IOI13_cave) C++14
100 / 100
289 ms 580 KB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int s[5005], curs[5005], door[5005];

int getstate(int comb, int i){
	return (comb > i || comb==-1);
}

void setcurs(int b, int f, int val){
	for(int i = b; i < f; ++i){
		if(~s[i]) curs[i] = s[i];
		else curs[i] = val;
	}
}

void exploreCave(int N) {
	fill(s, s+N, -1);

	for(int i = 0; i < N; ++i){
		setcurs(0, N, 0);
		int d = 0, state = getstate(tryCombination(curs), i);

		for(int j = 12; j >= 0; --j){
			setcurs(d, min(d + (1<<j), N), 1);

			if(getstate(tryCombination(curs), i) == state) d = min(d + (1<<j), N-1);
			else setcurs(d, min(d + (1<<j), N), 0);
		}
		door[d] = i;
		s[d] = (state ? 0 : 1);
	}

	answer(s, door);
}
# Verdict Execution time Memory Grader output
1 Correct 122 ms 396 KB Output is correct
2 Correct 117 ms 396 KB Output is correct
3 Correct 173 ms 396 KB Output is correct
4 Correct 126 ms 384 KB Output is correct
5 Correct 207 ms 580 KB Output is correct
6 Correct 159 ms 388 KB Output is correct
7 Correct 289 ms 392 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 163 ms 512 KB Output is correct
13 Correct 200 ms 332 KB Output is correct
14 Correct 162 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 213 ms 388 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 180 ms 384 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 216 ms 384 KB Output is correct
7 Correct 183 ms 512 KB Output is correct
8 Correct 273 ms 332 KB Output is correct
9 Correct 188 ms 332 KB Output is correct
10 Correct 189 ms 396 KB Output is correct
11 Correct 173 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 34 ms 332 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 36 ms 340 KB Output is correct
24 Correct 35 ms 332 KB Output is correct
25 Correct 40 ms 332 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 54 ms 356 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 35 ms 336 KB Output is correct
31 Correct 35 ms 332 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 35 ms 332 KB Output is correct
36 Correct 34 ms 332 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 396 KB Output is correct
2 Correct 117 ms 396 KB Output is correct
3 Correct 173 ms 396 KB Output is correct
4 Correct 126 ms 384 KB Output is correct
5 Correct 207 ms 580 KB Output is correct
6 Correct 159 ms 388 KB Output is correct
7 Correct 289 ms 392 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 163 ms 512 KB Output is correct
13 Correct 200 ms 332 KB Output is correct
14 Correct 162 ms 332 KB Output is correct
15 Correct 213 ms 388 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 180 ms 384 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 216 ms 384 KB Output is correct
21 Correct 183 ms 512 KB Output is correct
22 Correct 273 ms 332 KB Output is correct
23 Correct 188 ms 332 KB Output is correct
24 Correct 189 ms 396 KB Output is correct
25 Correct 173 ms 400 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 34 ms 332 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 1 ms 204 KB Output is correct
48 Correct 36 ms 340 KB Output is correct
49 Correct 35 ms 332 KB Output is correct
50 Correct 40 ms 332 KB Output is correct
51 Correct 1 ms 204 KB Output is correct
52 Correct 0 ms 204 KB Output is correct
53 Correct 54 ms 356 KB Output is correct
54 Correct 0 ms 204 KB Output is correct
55 Correct 35 ms 336 KB Output is correct
56 Correct 35 ms 332 KB Output is correct
57 Correct 0 ms 204 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 204 KB Output is correct
60 Correct 35 ms 332 KB Output is correct
61 Correct 34 ms 332 KB Output is correct
62 Correct 0 ms 204 KB Output is correct
63 Correct 129 ms 376 KB Output is correct
64 Correct 121 ms 392 KB Output is correct
65 Correct 178 ms 400 KB Output is correct
66 Correct 124 ms 388 KB Output is correct
67 Correct 206 ms 332 KB Output is correct
68 Correct 160 ms 388 KB Output is correct
69 Correct 212 ms 332 KB Output is correct
70 Correct 0 ms 204 KB Output is correct
71 Correct 0 ms 204 KB Output is correct
72 Correct 165 ms 388 KB Output is correct
73 Correct 161 ms 396 KB Output is correct
74 Correct 161 ms 408 KB Output is correct
75 Correct 179 ms 388 KB Output is correct
76 Correct 0 ms 204 KB Output is correct
77 Correct 0 ms 204 KB Output is correct
78 Correct 208 ms 508 KB Output is correct
79 Correct 219 ms 396 KB Output is correct
80 Correct 182 ms 332 KB Output is correct
81 Correct 184 ms 436 KB Output is correct
82 Correct 193 ms 384 KB Output is correct
83 Correct 176 ms 392 KB Output is correct
84 Correct 1 ms 204 KB Output is correct
85 Correct 36 ms 336 KB Output is correct
86 Correct 174 ms 392 KB Output is correct
87 Correct 1 ms 204 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 41 ms 336 KB Output is correct
90 Correct 34 ms 332 KB Output is correct
91 Correct 35 ms 332 KB Output is correct
92 Correct 177 ms 332 KB Output is correct
93 Correct 188 ms 332 KB Output is correct
94 Correct 172 ms 388 KB Output is correct
95 Correct 1 ms 204 KB Output is correct
96 Correct 1 ms 204 KB Output is correct
97 Correct 163 ms 392 KB Output is correct
98 Correct 44 ms 348 KB Output is correct
99 Correct 161 ms 388 KB Output is correct
100 Correct 1 ms 204 KB Output is correct
101 Correct 39 ms 452 KB Output is correct
102 Correct 34 ms 332 KB Output is correct
103 Correct 162 ms 380 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 1 ms 204 KB Output is correct
107 Correct 42 ms 336 KB Output is correct
108 Correct 39 ms 336 KB Output is correct
109 Correct 171 ms 384 KB Output is correct
110 Correct 175 ms 404 KB Output is correct
111 Correct 1 ms 204 KB Output is correct