# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
4477 |
2013-10-08T11:07:26 Z |
pichulia |
Cave (IOI13_cave) |
C++ |
|
143 ms |
512 KB |
#include "cave.h"
static int sw[5005];
static int de[5005];
void exploreCave(int N) {
int i, j;
int l, r, m;
int s[5005];
for(i=0; i<N;i++)
{
sw[i] = -1;
s[i] = -1;
de[i] = -1;
}
int result1;
int result2;
for(i=0; i<N; i++)
{
l=0;r=N-1;
while(l<r)
{
m=(l+r)/2;
for(j=l;j<=r;j++)
{
if(sw[j]==-1)
s[j]=1;
else
s[j]=sw[j];
}
result1 = tryCombination(s);
for(j=l;j<=m;j++)
{
if(sw[j]==-1)
s[j]=0;
else
s[j]=sw[j];
}
result2 = tryCombination(s);
// for(j=l;j<=r;j++)
// printf("%d",s[j]);
// printf("\n");
// printf("%d %d %d, %d %d\n",l,m,r, result1,result2);
if(result1 != i)
{
if(result2 == i)
{
r=m;
}
else
{
if(m==l)
l=m+1;
else
l=m;
}
}
else
{
if(result2==i)
{
if(m==l)
l=m+1;
else
l=m;
}
else
{
r=m;
}
}
}
// printf("%d\n",l);
s[l] = 0;
result1 = tryCombination(s);
s[l] = 1;
result2 = tryCombination(s);
if(result1 == i) sw[l] = 1;
else sw[l] = 0;
de[l] = i;
}
// printf("%d\n",tryCombination(sw));
answer(sw, de);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
125 ms |
488 KB |
too much calls on tryCombination() |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
143 ms |
512 KB |
too much calls on tryCombination() |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
5 ms |
512 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
328 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
512 KB |
Output is correct |
6 |
Correct |
100 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
83 ms |
512 KB |
Output is correct |
10 |
Correct |
82 ms |
512 KB |
Output is correct |
11 |
Correct |
90 ms |
444 KB |
Output is correct |
12 |
Correct |
6 ms |
396 KB |
Output is correct |
13 |
Correct |
6 ms |
384 KB |
Output is correct |
14 |
Correct |
84 ms |
452 KB |
Output is correct |
15 |
Correct |
6 ms |
384 KB |
Output is correct |
16 |
Correct |
77 ms |
512 KB |
Output is correct |
17 |
Correct |
77 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
512 KB |
Output is correct |
21 |
Correct |
84 ms |
456 KB |
Output is correct |
22 |
Correct |
75 ms |
464 KB |
Output is correct |
23 |
Correct |
6 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
496 KB |
too much calls on tryCombination() |
2 |
Halted |
0 ms |
0 KB |
- |