# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
545667 |
2022-04-05T06:46:11 Z |
AJ00 |
Cave (IOI13_cave) |
C++14 |
|
26 ms |
444 KB |
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
int n;
void exploreCave(int N){
n = N;
int S[n],D[n],temp[n];
vector<bool> found(n,false);
for (int i = 0; i < n; i++){
S[i] = 0;
D[i] = -1;
}
int ans = tryCombination(S),i=0,runs =0;
while (ans!=-1){
int prevans = ans;
while(prevans == ans){
//cout << ans << "\n";
//cout << runs << " ";
while (found[i]){
// cout << i << " ";
i = (i+1)%n;
}
// cout << "\n";
// cout << i << " ";
S[i] ^= 1;
runs++;
ans = tryCombination(S);
i = (i+1)%n;
}
//cout << prevans << " " << ans << " " << ((i-1)+n)%n << "\n";
if (ans == -1){
break;
}
found[((i-1)+n)%n] = true;
if (ans < prevans){
//D[((i-1)+n)%n] = ans;
S[((i-1)+n)%n] ^= 1;
ans = prevans;
//S1[i-1] = S[i-1];
}
//cout << "f " << ((i-1)+n)%n << " " << S[((i-1)+n)%n] << "\n";
}
// cout << runs << "\n";
for (int i = 0; i < n; i++){
temp[i] = S[i];
}
for (int i = 0; i < n; i++){
temp[i] ^= 1;
D[i] = tryCombination(temp);
temp[i] ^= 1;
//cout << D[i] << " ";
}
answer(S,D);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
340 KB |
Output is correct |
2 |
Correct |
11 ms |
428 KB |
Output is correct |
3 |
Correct |
26 ms |
312 KB |
Output is correct |
4 |
Correct |
15 ms |
312 KB |
Output is correct |
5 |
Correct |
14 ms |
444 KB |
Output is correct |
6 |
Correct |
20 ms |
312 KB |
Output is correct |
7 |
Correct |
22 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
19 ms |
444 KB |
Output is correct |
13 |
Correct |
19 ms |
340 KB |
Output is correct |
14 |
Correct |
22 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
444 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
13 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
9 ms |
444 KB |
Output is correct |
7 |
Correct |
14 ms |
340 KB |
Output is correct |
8 |
Correct |
16 ms |
440 KB |
Output is correct |
9 |
Correct |
10 ms |
444 KB |
Output is correct |
10 |
Correct |
11 ms |
340 KB |
Output is correct |
11 |
Correct |
10 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
308 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
308 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
308 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
308 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
304 KB |
Output is correct |
16 |
Correct |
1 ms |
304 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
1 ms |
300 KB |
Output is correct |
20 |
Incorrect |
6 ms |
372 KB |
too much calls on tryCombination() |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
340 KB |
Output is correct |
2 |
Correct |
11 ms |
428 KB |
Output is correct |
3 |
Correct |
26 ms |
312 KB |
Output is correct |
4 |
Correct |
15 ms |
312 KB |
Output is correct |
5 |
Correct |
14 ms |
444 KB |
Output is correct |
6 |
Correct |
20 ms |
312 KB |
Output is correct |
7 |
Correct |
22 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
19 ms |
444 KB |
Output is correct |
13 |
Correct |
19 ms |
340 KB |
Output is correct |
14 |
Correct |
22 ms |
340 KB |
Output is correct |
15 |
Correct |
10 ms |
444 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
13 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
9 ms |
444 KB |
Output is correct |
21 |
Correct |
14 ms |
340 KB |
Output is correct |
22 |
Correct |
16 ms |
440 KB |
Output is correct |
23 |
Correct |
10 ms |
444 KB |
Output is correct |
24 |
Correct |
11 ms |
340 KB |
Output is correct |
25 |
Correct |
10 ms |
432 KB |
Output is correct |
26 |
Correct |
1 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
300 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
300 KB |
Output is correct |
32 |
Correct |
1 ms |
308 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
308 KB |
Output is correct |
35 |
Correct |
1 ms |
304 KB |
Output is correct |
36 |
Correct |
1 ms |
308 KB |
Output is correct |
37 |
Correct |
1 ms |
212 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
304 KB |
Output is correct |
41 |
Correct |
1 ms |
304 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
300 KB |
Output is correct |
44 |
Correct |
1 ms |
300 KB |
Output is correct |
45 |
Incorrect |
6 ms |
372 KB |
too much calls on tryCombination() |
46 |
Halted |
0 ms |
0 KB |
- |