#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
int S[5001], D[5001];
bool used[5001];
void exploreCave(int N) {
int me = tryCombination(S);
if (me == -1) {
for (int i = 0; i < N; ++i){
S[i] = 1;
int dd = tryCombination(S);
D[i] = dd;
S[i] = 0;
}
} else {
for (int i = 0; i < N; ++i) {
int prevState = tryCombination(S);
for (int j = 0 ; j < N ; j++) {
if (used[j])
continue;
S[j] = 1;
int atm = tryCombination(S);
if (prevState == i && atm != i) {
used[j] = 1;
S[j] = 1;
D[j] = i;
break;
}
if (prevState != i && atm == i) {
used[j] = 1;
S[j] = 0;
D[j] = i;
break;
}
S[j] = 0;
}
}
}
answer(S, D);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
384 KB |
Output is correct |
2 |
Correct |
40 ms |
396 KB |
Output is correct |
3 |
Correct |
48 ms |
384 KB |
Output is correct |
4 |
Correct |
29 ms |
384 KB |
Output is correct |
5 |
Correct |
23 ms |
588 KB |
Output is correct |
6 |
Correct |
38 ms |
384 KB |
Output is correct |
7 |
Correct |
50 ms |
556 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 |
6 ms |
332 KB |
Output is correct |
12 |
Correct |
38 ms |
524 KB |
Output is correct |
13 |
Correct |
47 ms |
516 KB |
Output is correct |
14 |
Correct |
51 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
632 KB |
Output is correct |
2 |
Correct |
6 ms |
452 KB |
Output is correct |
3 |
Correct |
20 ms |
524 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
512 KB |
Output is correct |
6 |
Correct |
20 ms |
384 KB |
Output is correct |
7 |
Correct |
21 ms |
640 KB |
Output is correct |
8 |
Correct |
24 ms |
512 KB |
Output is correct |
9 |
Correct |
20 ms |
512 KB |
Output is correct |
10 |
Correct |
20 ms |
504 KB |
Output is correct |
11 |
Correct |
18 ms |
476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
452 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
420 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
452 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
452 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
420 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
452 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
460 KB |
Output is correct |
17 |
Correct |
5 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
396 KB |
Output is correct |
19 |
Correct |
5 ms |
512 KB |
Output is correct |
20 |
Incorrect |
7 ms |
384 KB |
too much calls on tryCombination() |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
632 KB |
Output is correct |
2 |
Correct |
6 ms |
452 KB |
Output is correct |
3 |
Correct |
20 ms |
524 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
512 KB |
Output is correct |
6 |
Correct |
20 ms |
384 KB |
Output is correct |
7 |
Correct |
21 ms |
640 KB |
Output is correct |
8 |
Correct |
24 ms |
512 KB |
Output is correct |
9 |
Correct |
20 ms |
512 KB |
Output is correct |
10 |
Correct |
20 ms |
504 KB |
Output is correct |
11 |
Correct |
18 ms |
476 KB |
Output is correct |
12 |
Correct |
6 ms |
512 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
6 ms |
512 KB |
Output is correct |
15 |
Correct |
6 ms |
512 KB |
Output is correct |
16 |
Correct |
6 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
452 KB |
Output is correct |
19 |
Correct |
5 ms |
512 KB |
Output is correct |
20 |
Correct |
6 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
420 KB |
Output is correct |
22 |
Correct |
5 ms |
512 KB |
Output is correct |
23 |
Correct |
6 ms |
384 KB |
Output is correct |
24 |
Correct |
6 ms |
452 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
512 KB |
Output is correct |
27 |
Correct |
5 ms |
460 KB |
Output is correct |
28 |
Correct |
5 ms |
512 KB |
Output is correct |
29 |
Correct |
5 ms |
396 KB |
Output is correct |
30 |
Correct |
5 ms |
512 KB |
Output is correct |
31 |
Incorrect |
7 ms |
384 KB |
too much calls on tryCombination() |
32 |
Halted |
0 ms |
0 KB |
- |