# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
317190 |
2020-10-29T05:14:52 Z |
seedkin |
Cave (IOI13_cave) |
C |
|
713 ms |
632 KB |
#include "cave.h"
int open[5005]; // index = switch number return = 1, 0 ( open value )
int target[5005]; // index = switch number return = door number
int S[5005]; // index == switch number return = 1, 0 ( open Value request)
int door[5005]; // index = door 번호 return 1, 0 (1 == open, 0 == close);
void exploreCave(int N) {
for(int i =0; i < N; i++) {
open[i] = -1;
target[i] = -1;
}
for(int i = 0; i < N; i++) { // door number
for(int j = 0; j < N; j++) { // switch number
if(open[j] != -1) {
S[j] = open[j];
} else {
S[j] = 1;
}
}
int ans = tryCombination(S);
if (ans > i || ans == -1) door[i] = 1;
else door[i] = 0;
int low = 0;
int high = N;
int mid = (low + high) / 2;
while ( low != mid) {
for (int j = 0; j < mid; j++) {
if(open[j] != -1) {
S[j] = open[j];
}
S[j] = door[i];
}
for (int j = mid; j < N; j++) {
if(open[j] != -1) {
S[j] = open[j];
} else {
S[j] = 1-door[i];
}
}
ans = tryCombination(S);
if(ans > i || ans == -1) {
high = mid;
mid = (low + high) / 2;
} else {
low = mid;
mid = (low + high) / 2;
}
}
open[mid] = door[i];
target[mid] = i;
}
answer(open, target);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
123 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
445 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
506 ms |
504 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
447 ms |
632 KB |
Output is correct |
7 |
Correct |
583 ms |
632 KB |
Output is correct |
8 |
Correct |
711 ms |
632 KB |
Output is correct |
9 |
Correct |
707 ms |
504 KB |
Output is correct |
10 |
Correct |
713 ms |
504 KB |
Output is correct |
11 |
Correct |
573 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Incorrect |
1 ms |
384 KB |
Answer is wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Incorrect |
1 ms |
384 KB |
Answer is wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
123 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |