# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
80098 |
2018-10-19T02:55:34 Z |
AngelKnows |
Cave (IOI13_cave) |
C++14 |
|
234 ms |
444 KB |
#include "cave.h"
bool keep[5005];
int s[5005],d[5005];
void flip(int l,int r) {
for (int j=l;j<=r;j++) {
if (!keep[j]) s[j]=1-s[j];
}
}
void exploreCave(int N) {
for (int i=1;i<=N;i++) s[i]=0;
int x;
int l,r,mid;
for (int i=1;i<=N;i++) {
x=tryCombination(s);
if (x!=i) flip(1,N);
l=1,r=N;
while (l<=r) {
mid=(l+r)>>1;
flip(l,mid);
x=tryCombination(s);
if (l==r) {
if (x==i) s[l]=1-s[l],keep[l]=1;
else keep[l]=1;
d[l]=i;
break;
}
if (x!=i) {
flip(l,mid);
r=mid;
} else {
l=mid+1;
}
}
}
answer(s,d);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
444 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
234 ms |
440 KB |
too much calls on tryCombination() |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
360 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
360 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
444 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |