# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845826 | 2023-09-06T16:05:37 Z | Marco_Escandon | Rarest Insects (IOI22_insects) | C++17 | 89 ms | 1400 KB |
#include<bits/stdc++.h> using namespace std; #include <vector> typedef long long ll; void move_inside(int i); void move_outside(int i); int press_button(); int min_cardinality(int n) { ll bs=1000000000000; ll k=0;set<ll> s; for(int i=0; i<n; i++) { move_inside(i); if(press_button()==2) move_outside(i); else s.insert(i); } k=s.size(); for(auto i: s)move_outside(i);s.clear(); if(n*log2(n/k)>n*k/2) { ll v[n]={ }; for(int i=0; i<n; i++) { if(v[i]==0) { move_inside(i); for(int j=i+1; j<n; j++) { if(v[j]==0) { move_inside(j); if(press_button()==2) { v[i]++; v[j]=-1; } move_outside(j); } } move_outside(i); } } for(int j=0; j<n; j++) { if(v[j]!=-1) bs=min(bs,v[j]+1); } return bs; } ll a=1,b=(n/k)+1; while(abs(a-b)!=1) { ll m=(a+b)/2; ll c=0; for(int i=0; i<n; i++) { move_inside(i); if(press_button()==m+1) { move_outside(i); c++; } else { s.insert(i); } } for(auto i: s)move_outside(i);s.clear(); if(m*k+c!=n) b=m; else a=m; } return b-1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 4 ms | 856 KB | Output is correct |
9 | Correct | 5 ms | 600 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 4 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 600 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 5 ms | 856 KB | Output is correct |
17 | Correct | 4 ms | 600 KB | Output is correct |
18 | Correct | 4 ms | 600 KB | Output is correct |
19 | Correct | 3 ms | 600 KB | Output is correct |
20 | Correct | 4 ms | 856 KB | Output is correct |
21 | Correct | 2 ms | 600 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 4 ms | 856 KB | Output is correct |
9 | Correct | 5 ms | 600 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 4 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 600 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 5 ms | 856 KB | Output is correct |
17 | Correct | 4 ms | 600 KB | Output is correct |
18 | Correct | 4 ms | 600 KB | Output is correct |
19 | Correct | 3 ms | 600 KB | Output is correct |
20 | Correct | 4 ms | 856 KB | Output is correct |
21 | Correct | 2 ms | 600 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 11 ms | 600 KB | Output is correct |
24 | Correct | 4 ms | 344 KB | Output is correct |
25 | Correct | 28 ms | 864 KB | Output is correct |
26 | Correct | 29 ms | 924 KB | Output is correct |
27 | Correct | 13 ms | 600 KB | Output is correct |
28 | Correct | 5 ms | 1116 KB | Output is correct |
29 | Correct | 22 ms | 600 KB | Output is correct |
30 | Correct | 28 ms | 600 KB | Output is correct |
31 | Correct | 18 ms | 600 KB | Output is correct |
32 | Correct | 24 ms | 600 KB | Output is correct |
33 | Correct | 36 ms | 600 KB | Output is correct |
34 | Correct | 45 ms | 600 KB | Output is correct |
35 | Correct | 41 ms | 956 KB | Output is correct |
36 | Correct | 35 ms | 1112 KB | Output is correct |
37 | Correct | 23 ms | 696 KB | Output is correct |
38 | Correct | 19 ms | 676 KB | Output is correct |
39 | Correct | 16 ms | 700 KB | Output is correct |
40 | Correct | 9 ms | 600 KB | Output is correct |
41 | Correct | 6 ms | 712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 24 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 1168 KB | Output is correct |
9 | Partially correct | 73 ms | 1260 KB | Output is partially correct |
10 | Partially correct | 63 ms | 908 KB | Output is partially correct |
11 | Correct | 18 ms | 600 KB | Output is correct |
12 | Correct | 20 ms | 1372 KB | Output is correct |
13 | Partially correct | 41 ms | 600 KB | Output is partially correct |
14 | Partially correct | 55 ms | 1104 KB | Output is partially correct |
15 | Partially correct | 54 ms | 592 KB | Output is partially correct |
16 | Partially correct | 58 ms | 592 KB | Output is partially correct |
17 | Partially correct | 66 ms | 344 KB | Output is partially correct |
18 | Partially correct | 83 ms | 428 KB | Output is partially correct |
19 | Partially correct | 88 ms | 1176 KB | Output is partially correct |
20 | Partially correct | 79 ms | 1236 KB | Output is partially correct |
21 | Partially correct | 57 ms | 964 KB | Output is partially correct |
22 | Partially correct | 58 ms | 1208 KB | Output is partially correct |
23 | Partially correct | 41 ms | 928 KB | Output is partially correct |
24 | Correct | 34 ms | 864 KB | Output is correct |
25 | Correct | 20 ms | 1120 KB | Output is correct |
26 | Correct | 12 ms | 856 KB | Output is correct |
27 | Partially correct | 62 ms | 848 KB | Output is partially correct |
28 | Partially correct | 58 ms | 736 KB | Output is partially correct |
29 | Partially correct | 89 ms | 1256 KB | Output is partially correct |
30 | Partially correct | 77 ms | 1372 KB | Output is partially correct |
31 | Partially correct | 64 ms | 972 KB | Output is partially correct |
32 | Partially correct | 59 ms | 1200 KB | Output is partially correct |
33 | Partially correct | 49 ms | 1132 KB | Output is partially correct |
34 | Partially correct | 52 ms | 1200 KB | Output is partially correct |
35 | Partially correct | 82 ms | 1008 KB | Output is partially correct |
36 | Partially correct | 82 ms | 1148 KB | Output is partially correct |
37 | Partially correct | 66 ms | 928 KB | Output is partially correct |
38 | Partially correct | 63 ms | 976 KB | Output is partially correct |
39 | Partially correct | 47 ms | 944 KB | Output is partially correct |
40 | Partially correct | 64 ms | 712 KB | Output is partially correct |
41 | Partially correct | 67 ms | 944 KB | Output is partially correct |
42 | Partially correct | 69 ms | 1400 KB | Output is partially correct |
43 | Correct | 8 ms | 344 KB | Output is correct |
44 | Correct | 18 ms | 592 KB | Output is correct |
45 | Correct | 22 ms | 592 KB | Output is correct |
46 | Correct | 20 ms | 856 KB | Output is correct |
47 | Correct | 18 ms | 856 KB | Output is correct |
48 | Correct | 19 ms | 1100 KB | Output is correct |