# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891279 |
2023-12-22T16:17:24 Z |
presko |
Cave (IOI13_cave) |
C++14 |
|
594 ms |
1052 KB |
#include "cave.h"
bool found[6000];
int state[6000];
int swtch[6000];
bool start[6000];
int s[6000];
int ga[6000];
int fil(int ind,int n)
{
int l=0,r=n-1;
while(r!=l)
{
int mid=(l+r+1)/2;
for(int i=0;i<n;i++)
{
if(found[i]){s[i]=state[i];continue;}
if(i<mid)s[i]=1;
else s[i]=0;
}
int ans=tryCombination(s);
bool sta=0;
if(ans>ind || ans==-1)sta=1;
if(sta!=start[ind])r=mid-1;
else l=mid;
}
swtch[l]=ind;
found[l]=1;
if(start[ind]==1)state[l]=0;
else state[l]=1;
return l;
}
void exploreCave(int N)
{
for(int i=0;i<N;i++)
{
int res=tryCombination(ga);
if(res==-1)res=N;
for(int j=0;j<res;j++)start[j]=1;
for(int j=res;j<N;j++)start[j]=0;
int x=fil(i,N);
ga[x]=state[x];
}
answer(state,swtch);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
528 KB |
Output is correct |
2 |
Correct |
275 ms |
348 KB |
Output is correct |
3 |
Correct |
431 ms |
592 KB |
Output is correct |
4 |
Correct |
286 ms |
344 KB |
Output is correct |
5 |
Correct |
473 ms |
784 KB |
Output is correct |
6 |
Correct |
425 ms |
796 KB |
Output is correct |
7 |
Correct |
469 ms |
592 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
424 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
419 ms |
544 KB |
Output is correct |
13 |
Correct |
422 ms |
592 KB |
Output is correct |
14 |
Correct |
424 ms |
540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
475 ms |
564 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
404 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
424 KB |
Output is correct |
6 |
Correct |
470 ms |
556 KB |
Output is correct |
7 |
Correct |
360 ms |
808 KB |
Output is correct |
8 |
Correct |
561 ms |
856 KB |
Output is correct |
9 |
Correct |
576 ms |
604 KB |
Output is correct |
10 |
Correct |
576 ms |
588 KB |
Output is correct |
11 |
Correct |
355 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
50 ms |
512 KB |
Output is correct |
21 |
Correct |
0 ms |
604 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
73 ms |
348 KB |
Output is correct |
24 |
Correct |
73 ms |
348 KB |
Output is correct |
25 |
Correct |
73 ms |
504 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
60 ms |
500 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
50 ms |
508 KB |
Output is correct |
31 |
Correct |
50 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
73 ms |
508 KB |
Output is correct |
36 |
Correct |
73 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
528 KB |
Output is correct |
2 |
Correct |
275 ms |
348 KB |
Output is correct |
3 |
Correct |
431 ms |
592 KB |
Output is correct |
4 |
Correct |
286 ms |
344 KB |
Output is correct |
5 |
Correct |
473 ms |
784 KB |
Output is correct |
6 |
Correct |
425 ms |
796 KB |
Output is correct |
7 |
Correct |
469 ms |
592 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
424 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
419 ms |
544 KB |
Output is correct |
13 |
Correct |
422 ms |
592 KB |
Output is correct |
14 |
Correct |
424 ms |
540 KB |
Output is correct |
15 |
Correct |
475 ms |
564 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
404 ms |
436 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
424 KB |
Output is correct |
20 |
Correct |
470 ms |
556 KB |
Output is correct |
21 |
Correct |
360 ms |
808 KB |
Output is correct |
22 |
Correct |
561 ms |
856 KB |
Output is correct |
23 |
Correct |
576 ms |
604 KB |
Output is correct |
24 |
Correct |
576 ms |
588 KB |
Output is correct |
25 |
Correct |
355 ms |
596 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
50 ms |
512 KB |
Output is correct |
46 |
Correct |
0 ms |
604 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
73 ms |
348 KB |
Output is correct |
49 |
Correct |
73 ms |
348 KB |
Output is correct |
50 |
Correct |
73 ms |
504 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
60 ms |
500 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
50 ms |
508 KB |
Output is correct |
56 |
Correct |
50 ms |
344 KB |
Output is correct |
57 |
Correct |
1 ms |
344 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
73 ms |
508 KB |
Output is correct |
61 |
Correct |
73 ms |
348 KB |
Output is correct |
62 |
Correct |
0 ms |
348 KB |
Output is correct |
63 |
Correct |
305 ms |
564 KB |
Output is correct |
64 |
Correct |
277 ms |
560 KB |
Output is correct |
65 |
Correct |
426 ms |
540 KB |
Output is correct |
66 |
Correct |
288 ms |
348 KB |
Output is correct |
67 |
Correct |
477 ms |
604 KB |
Output is correct |
68 |
Correct |
426 ms |
596 KB |
Output is correct |
69 |
Correct |
465 ms |
592 KB |
Output is correct |
70 |
Correct |
0 ms |
344 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
429 ms |
1052 KB |
Output is correct |
73 |
Correct |
423 ms |
592 KB |
Output is correct |
74 |
Correct |
484 ms |
596 KB |
Output is correct |
75 |
Correct |
455 ms |
596 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 KB |
Output is correct |
78 |
Correct |
470 ms |
552 KB |
Output is correct |
79 |
Correct |
353 ms |
596 KB |
Output is correct |
80 |
Correct |
567 ms |
608 KB |
Output is correct |
81 |
Correct |
568 ms |
600 KB |
Output is correct |
82 |
Correct |
576 ms |
600 KB |
Output is correct |
83 |
Correct |
350 ms |
832 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
52 ms |
512 KB |
Output is correct |
86 |
Correct |
357 ms |
552 KB |
Output is correct |
87 |
Correct |
0 ms |
348 KB |
Output is correct |
88 |
Correct |
0 ms |
348 KB |
Output is correct |
89 |
Correct |
81 ms |
504 KB |
Output is correct |
90 |
Correct |
73 ms |
348 KB |
Output is correct |
91 |
Correct |
86 ms |
508 KB |
Output is correct |
92 |
Correct |
566 ms |
608 KB |
Output is correct |
93 |
Correct |
561 ms |
604 KB |
Output is correct |
94 |
Correct |
594 ms |
604 KB |
Output is correct |
95 |
Correct |
1 ms |
348 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
428 ms |
816 KB |
Output is correct |
98 |
Correct |
61 ms |
508 KB |
Output is correct |
99 |
Correct |
422 ms |
580 KB |
Output is correct |
100 |
Correct |
0 ms |
600 KB |
Output is correct |
101 |
Correct |
50 ms |
600 KB |
Output is correct |
102 |
Correct |
50 ms |
348 KB |
Output is correct |
103 |
Correct |
343 ms |
592 KB |
Output is correct |
104 |
Correct |
1 ms |
344 KB |
Output is correct |
105 |
Correct |
0 ms |
348 KB |
Output is correct |
106 |
Correct |
1 ms |
348 KB |
Output is correct |
107 |
Correct |
81 ms |
504 KB |
Output is correct |
108 |
Correct |
75 ms |
464 KB |
Output is correct |
109 |
Correct |
567 ms |
604 KB |
Output is correct |
110 |
Correct |
558 ms |
600 KB |
Output is correct |
111 |
Correct |
0 ms |
348 KB |
Output is correct |