# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1076475 |
2024-08-26T14:10:26 Z |
juicy |
Cave (IOI13_cave) |
C++17 |
|
98 ms |
628 KB |
#include "cave.h"
#include <bits/stdc++.h>
int S[5000], D[5000], q[5000];
void exploreCave(int N) {
memset(S, -1, sizeof(S));
auto search = [&]() {
std::vector<int> cands;
for (int i = 0; i < N; ++i) {
if (S[i] != -1) {
q[i] = S[i];
} else {
cands.push_back(i);
q[i] = 0;
}
}
int door = tryCombination(q);
if (door == -1) {
q[cands[0]] = 1;
door = tryCombination(q);
D[cands[0]] = door;
S[cands[0]] = 0;
return;
}
int l = 0, r = cands.size() - 1, p = -1;
while (l <= r) {
int md = (l + r) / 2;
for (int i = 0; i < md; ++i) {
q[cands[i]] = 1;
}
if (tryCombination(q) == door) {
p = md;
l = md + 1;
} else {
r = md - 1;
}
for (int i = 0; i < md; ++i) {
q[cands[i]] = 0;
}
}
D[cands[p]] = door;
S[cands[p]] = 1;
};
int cnt = 0;
while (cnt++ < N) {
search();
}
answer(S, D);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
98 ms |
344 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
81 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
81 ms |
620 KB |
Output is correct |
7 |
Correct |
81 ms |
600 KB |
Output is correct |
8 |
Correct |
89 ms |
604 KB |
Output is correct |
9 |
Correct |
82 ms |
600 KB |
Output is correct |
10 |
Correct |
82 ms |
600 KB |
Output is correct |
11 |
Correct |
80 ms |
628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Incorrect |
1 ms |
348 KB |
Answer is wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Incorrect |
1 ms |
348 KB |
Answer is wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
98 ms |
344 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |