# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
16332 |
2015-08-21T11:58:30 Z |
comet |
Cave (IOI13_cave) |
C++ |
|
107 ms |
448 KB |
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include "cave.h"
int a[5000],b[5000],p,n;
bool flip(int L,int R){
bool ret=0;
for(int i=L;i<=R;i++){
if(b[i]<0)a[i]=!a[i],ret=1;
}
return ret;
}
void f(int L,int R,int v){
if(L==R){
b[L]=v;
if(p==v)a[L]=!a[L];
return;
}
int mid=(L+R)/2;
int t=tryCombination(a);
flip(L,mid);
if((p!=v&&t!=v)||p==t)f(mid+1,R,v);
else f(L,mid,v);
}
void exploreCave(int N){
n=N;
memset(b,-1,sizeof(b));
for(int i=0;i<N;i++){
p=tryCombination(a);
f(0,N-1,i);
}
answer(a,b);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
448 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
107 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
324 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |