#include<bits/stdc++.h>
#include "insects.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,lef,rig,mid,bo[2009],raod,BO[2009],ZED[2009],FORA;
vector <int> diff;
void ADD(int i){
move_inside(i-1);bo[i]=1;
}
void REM(int i){
move_outside(i-1);bo[i]=0;
}
int ask(){
return press_button();
}
int min_cardinality(int NN) {
a=NN;
for(i=1; i<=a; i++){
ADD(i);
c=ask();
if(c>1){
REM(i);
}else{
diff.push_back(i);
}
}
for(i=1; i<=a; i++){
if(bo[i]==1) REM(i);
}
raod=diff.size();
lef=1;rig=a/raod+1;
while(1){
if(lef+1>=rig) break;
mid=(lef+rig)/2;
for(i=0; i<=a+1; i++){
ZED[i]=0;
}
for(i=1; i<=a; i++){
if(BO[i]==1) continue;
ADD(i);
c=ask();
if(c>mid-FORA){
REM(i);ZED[i]=1;
}else{
;
}
}
zx=0;
for(i=1; i<=a; i++){
if(bo[i]==1) zx++;
}
if(zx==(mid-FORA)*raod){
lef=mid;FORA=mid;
for(i=1; i<=a; i++){
if(bo[i]==1){
BO[i]=1;//shegidzlia yvelas mid occurence amoshalo
}
}
//lef=mid;
}else{
rig=mid;
for(i=1; i<=a; i++){
if(ZED[i]==1){
BO[i]=1;
}
}
}
for(i=1; i<=a; i++){
if(bo[i]==1) REM(i);
}
}
return lef;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
308 KB |
Output is correct |
7 |
Correct |
2 ms |
308 KB |
Output is correct |
8 |
Correct |
5 ms |
208 KB |
Output is correct |
9 |
Correct |
5 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
2 ms |
208 KB |
Output is correct |
12 |
Correct |
4 ms |
208 KB |
Output is correct |
13 |
Correct |
5 ms |
208 KB |
Output is correct |
14 |
Correct |
5 ms |
336 KB |
Output is correct |
15 |
Correct |
3 ms |
304 KB |
Output is correct |
16 |
Correct |
6 ms |
208 KB |
Output is correct |
17 |
Correct |
4 ms |
208 KB |
Output is correct |
18 |
Correct |
4 ms |
208 KB |
Output is correct |
19 |
Correct |
5 ms |
312 KB |
Output is correct |
20 |
Correct |
5 ms |
208 KB |
Output is correct |
21 |
Correct |
3 ms |
308 KB |
Output is correct |
22 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
308 KB |
Output is correct |
7 |
Correct |
2 ms |
308 KB |
Output is correct |
8 |
Correct |
5 ms |
208 KB |
Output is correct |
9 |
Correct |
5 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
2 ms |
208 KB |
Output is correct |
12 |
Correct |
4 ms |
208 KB |
Output is correct |
13 |
Correct |
5 ms |
208 KB |
Output is correct |
14 |
Correct |
5 ms |
336 KB |
Output is correct |
15 |
Correct |
3 ms |
304 KB |
Output is correct |
16 |
Correct |
6 ms |
208 KB |
Output is correct |
17 |
Correct |
4 ms |
208 KB |
Output is correct |
18 |
Correct |
4 ms |
208 KB |
Output is correct |
19 |
Correct |
5 ms |
312 KB |
Output is correct |
20 |
Correct |
5 ms |
208 KB |
Output is correct |
21 |
Correct |
3 ms |
308 KB |
Output is correct |
22 |
Correct |
2 ms |
208 KB |
Output is correct |
23 |
Correct |
20 ms |
312 KB |
Output is correct |
24 |
Correct |
10 ms |
308 KB |
Output is correct |
25 |
Correct |
22 ms |
308 KB |
Output is correct |
26 |
Correct |
19 ms |
304 KB |
Output is correct |
27 |
Correct |
20 ms |
312 KB |
Output is correct |
28 |
Correct |
4 ms |
308 KB |
Output is correct |
29 |
Correct |
17 ms |
296 KB |
Output is correct |
30 |
Correct |
20 ms |
304 KB |
Output is correct |
31 |
Correct |
23 ms |
312 KB |
Output is correct |
32 |
Correct |
20 ms |
308 KB |
Output is correct |
33 |
Correct |
20 ms |
292 KB |
Output is correct |
34 |
Correct |
15 ms |
208 KB |
Output is correct |
35 |
Correct |
32 ms |
208 KB |
Output is correct |
36 |
Correct |
21 ms |
300 KB |
Output is correct |
37 |
Correct |
20 ms |
304 KB |
Output is correct |
38 |
Correct |
20 ms |
312 KB |
Output is correct |
39 |
Correct |
20 ms |
312 KB |
Output is correct |
40 |
Correct |
20 ms |
312 KB |
Output is correct |
41 |
Correct |
8 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
46 ms |
308 KB |
Output is correct |
8 |
Correct |
17 ms |
312 KB |
Output is correct |
9 |
Correct |
60 ms |
304 KB |
Output is correct |
10 |
Correct |
38 ms |
304 KB |
Output is correct |
11 |
Correct |
36 ms |
312 KB |
Output is correct |
12 |
Correct |
32 ms |
308 KB |
Output is correct |
13 |
Correct |
42 ms |
304 KB |
Output is correct |
14 |
Correct |
58 ms |
300 KB |
Output is correct |
15 |
Correct |
48 ms |
304 KB |
Output is correct |
16 |
Correct |
59 ms |
312 KB |
Output is correct |
17 |
Correct |
50 ms |
312 KB |
Output is correct |
18 |
Correct |
34 ms |
304 KB |
Output is correct |
19 |
Partially correct |
41 ms |
208 KB |
Output is partially correct |
20 |
Correct |
39 ms |
308 KB |
Output is correct |
21 |
Correct |
52 ms |
300 KB |
Output is correct |
22 |
Partially correct |
34 ms |
308 KB |
Output is partially correct |
23 |
Correct |
41 ms |
312 KB |
Output is correct |
24 |
Correct |
43 ms |
308 KB |
Output is correct |
25 |
Correct |
24 ms |
300 KB |
Output is correct |
26 |
Correct |
12 ms |
208 KB |
Output is correct |
27 |
Correct |
25 ms |
304 KB |
Output is correct |
28 |
Correct |
51 ms |
312 KB |
Output is correct |
29 |
Partially correct |
52 ms |
288 KB |
Output is partially correct |
30 |
Partially correct |
46 ms |
300 KB |
Output is partially correct |
31 |
Correct |
50 ms |
308 KB |
Output is correct |
32 |
Correct |
47 ms |
208 KB |
Output is correct |
33 |
Correct |
53 ms |
292 KB |
Output is correct |
34 |
Correct |
22 ms |
304 KB |
Output is correct |
35 |
Partially correct |
55 ms |
296 KB |
Output is partially correct |
36 |
Partially correct |
51 ms |
312 KB |
Output is partially correct |
37 |
Correct |
38 ms |
308 KB |
Output is correct |
38 |
Correct |
38 ms |
208 KB |
Output is correct |
39 |
Correct |
30 ms |
308 KB |
Output is correct |
40 |
Correct |
53 ms |
208 KB |
Output is correct |
41 |
Partially correct |
38 ms |
296 KB |
Output is partially correct |
42 |
Partially correct |
26 ms |
292 KB |
Output is partially correct |
43 |
Correct |
10 ms |
292 KB |
Output is correct |
44 |
Correct |
33 ms |
308 KB |
Output is correct |
45 |
Correct |
37 ms |
308 KB |
Output is correct |
46 |
Correct |
21 ms |
308 KB |
Output is correct |
47 |
Correct |
15 ms |
308 KB |
Output is correct |
48 |
Correct |
36 ms |
304 KB |
Output is correct |