# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
311795 |
2020-10-11T17:56:19 Z |
saarang123 |
Cave (IOI13_cave) |
C++14 |
|
44 ms |
448 KB |
#include "cave.h"
void exploreCave(int n) {
int a[n], s[n], d[n];
for(int i = 0; i < n; i++)
a[i] = 0, s[i] = 0, d[i] = -1;
for(int i = 0; i < n; i++) {
if(d[i] != -1) continue;
a[i] ^= 1;
int mn = 0, mx = n - 1, id = 0, k = 0;
int x = tryCombination(a);
if(x == -1) break;
while(mn < mx) {
int mid = (mn + mx) >> 1;
//cout << "Binsearch: " << mn << " " << mid << " " << mx << endl;
for(int j = mn; j <= mid; j++)
if(d[j] == -1 && j != i)
a[j] ^= 1;
k = tryCombination(a);
for(int j = mn; j <= mid; j++)
if(d[j] == -1 && j != i)
a[j] ^= 1;
if(k < x)
mx = mid;
else
mn = mid + 1;
}
id = mn;
a[id] ^= 1;
k = tryCombination(a);
if(k == -1) d[id] = x;
else d[id] = k, a[id] ^= 1;
//cout << "Binsearch end: " << id << " k: " << k << " d[id]: " << d[id] << endl; cout << endl;
}
for(int i = 0; i < n; i++) s[i] = a[i];
//answer(s, d);
for(int i = 0; i < n; i++) {
if(d[i] != -1) continue;
s[i] ^= 1;
d[i] = tryCombination(s);
s[i] ^= 1;
}
answer(s, d);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
448 KB |
too much calls on tryCombination() |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |