# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
320383 |
2020-11-08T12:55:35 Z |
egod1537 |
Cave (IOI13_cave) |
C++14 |
|
88 ms |
484 KB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
bitset<5001> vit;
void exploreCave(int n) {
int* arr = new int[n];
int* cnt = new int[n];
function<void(int, int)> rev = [&](int s, int e) -> void {
for (int i = s; i <= e; i++) {
if (vit[i]) continue;
arr[i] = (arr[i] == 1) ? 0 : 1;
}
};
for (int i = 0; i < n; i++) {
int pos = 0;
int k = tryCombination(arr);
if (k == -1) continue;
int lo = 0, hi = n - 1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
rev(lo, mid);
int w = tryCombination(arr);
//이미 문이 열려있음
if (k > i) {
if (w == i) hi = mid - 1;
else lo = mid + 1;
}
//이미 문이 닫혀있을 때
else {
if (w > i) hi = mid - 1;
else lo = mid + 1;
}
rev(lo, mid);
}
if (k <= i) arr[pos] = (arr[pos] == 1) ? 0 : 1;
cnt[i] = pos;
vit[pos] = true;
}
answer(arr, cnt);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
484 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
364 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
484 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |