# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
836347 | 2023-08-24T10:26:20 Z | Trumling | Rarest Insects (IOI22_insects) | C++17 | 206 ms | 464 KB |
#include "insects.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) x.begin(),x.end() typedef long long ll; #define pb push_back #define INF 99999999999999 int min_cardinality(int N) { ll n=N; vector<int>type(n,-1); vector<int>count(n,1); ll r=0; while((N-1)>>r) r++; vector<int>go(n,(1<<r)-1); ll ans=INF; set<int>s; vector<int>v; for(int i=0;i<N;i++) { move_inside(i); ll p=press_button(); if(p!=1) move_outside(i); else { type[i]=i; v.pb(i); } } for(auto x:v) move_outside(x); for(int j=0;(1<<j)<N;j++) { for(auto x:v) { if((!((1<<j)&x)) && s.find(x)==s.end()) { s.insert(x); move_inside(x); } if(((1<<j)&x) && s.find(x)!=s.end()) { s.erase(x); move_outside(x); } } for(int i=0;i<N;i++) if(type[i]==-1) { move_inside(i); ll p=press_button(); if(p!=1) go[i]-=(1<<j); move_outside(i); } } //for(int i=0;i<N;i++) // cout<<go[i]<<' '; for(int i=0;i<N;i++) if(type[i]==-1) count[go[i]]++; for(int i=0;i<N;i++) if(type[i]!=-1) ans=min(ans,(ll)count[i]); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Correct | 13 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 208 KB | Output is correct |
8 | Correct | 12 ms | 208 KB | Output is correct |
9 | Correct | 14 ms | 208 KB | Output is correct |
10 | Correct | 16 ms | 208 KB | Output is correct |
11 | Correct | 6 ms | 208 KB | Output is correct |
12 | Correct | 16 ms | 208 KB | Output is correct |
13 | Correct | 14 ms | 208 KB | Output is correct |
14 | Correct | 12 ms | 208 KB | Output is correct |
15 | Correct | 13 ms | 208 KB | Output is correct |
16 | Correct | 10 ms | 208 KB | Output is correct |
17 | Correct | 16 ms | 208 KB | Output is correct |
18 | Correct | 12 ms | 208 KB | Output is correct |
19 | Correct | 17 ms | 208 KB | Output is correct |
20 | Correct | 14 ms | 208 KB | Output is correct |
21 | Correct | 8 ms | 208 KB | Output is correct |
22 | Correct | 5 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Correct | 13 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 208 KB | Output is correct |
8 | Correct | 12 ms | 208 KB | Output is correct |
9 | Correct | 14 ms | 208 KB | Output is correct |
10 | Correct | 16 ms | 208 KB | Output is correct |
11 | Correct | 6 ms | 208 KB | Output is correct |
12 | Correct | 16 ms | 208 KB | Output is correct |
13 | Correct | 14 ms | 208 KB | Output is correct |
14 | Correct | 12 ms | 208 KB | Output is correct |
15 | Correct | 13 ms | 208 KB | Output is correct |
16 | Correct | 10 ms | 208 KB | Output is correct |
17 | Correct | 16 ms | 208 KB | Output is correct |
18 | Correct | 12 ms | 208 KB | Output is correct |
19 | Correct | 17 ms | 208 KB | Output is correct |
20 | Correct | 14 ms | 208 KB | Output is correct |
21 | Correct | 8 ms | 208 KB | Output is correct |
22 | Correct | 5 ms | 308 KB | Output is correct |
23 | Correct | 63 ms | 208 KB | Output is correct |
24 | Correct | 8 ms | 464 KB | Output is correct |
25 | Correct | 59 ms | 208 KB | Output is correct |
26 | Correct | 68 ms | 208 KB | Output is correct |
27 | Correct | 78 ms | 208 KB | Output is correct |
28 | Correct | 45 ms | 324 KB | Output is correct |
29 | Correct | 75 ms | 208 KB | Output is correct |
30 | Correct | 77 ms | 208 KB | Output is correct |
31 | Correct | 74 ms | 208 KB | Output is correct |
32 | Correct | 40 ms | 208 KB | Output is correct |
33 | Correct | 89 ms | 208 KB | Output is correct |
34 | Correct | 62 ms | 208 KB | Output is correct |
35 | Correct | 69 ms | 208 KB | Output is correct |
36 | Correct | 70 ms | 208 KB | Output is correct |
37 | Correct | 77 ms | 292 KB | Output is correct |
38 | Correct | 95 ms | 288 KB | Output is correct |
39 | Correct | 73 ms | 300 KB | Output is correct |
40 | Correct | 54 ms | 208 KB | Output is correct |
41 | Correct | 39 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 | 1 ms | 208 KB | Output is correct |
5 | Partially correct | 1 ms | 208 KB | Output is partially correct |
6 | Partially correct | 1 ms | 208 KB | Output is partially correct |
7 | Partially correct | 163 ms | 208 KB | Output is partially correct |
8 | Partially correct | 16 ms | 448 KB | Output is partially correct |
9 | Partially correct | 132 ms | 308 KB | Output is partially correct |
10 | Partially correct | 134 ms | 308 KB | Output is partially correct |
11 | Partially correct | 131 ms | 208 KB | Output is partially correct |
12 | Partially correct | 61 ms | 460 KB | Output is partially correct |
13 | Partially correct | 145 ms | 208 KB | Output is partially correct |
14 | Partially correct | 182 ms | 308 KB | Output is partially correct |
15 | Partially correct | 136 ms | 208 KB | Output is partially correct |
16 | Partially correct | 148 ms | 208 KB | Output is partially correct |
17 | Partially correct | 91 ms | 208 KB | Output is partially correct |
18 | Partially correct | 120 ms | 208 KB | Output is partially correct |
19 | Partially correct | 173 ms | 260 KB | Output is partially correct |
20 | Partially correct | 93 ms | 208 KB | Output is partially correct |
21 | Partially correct | 115 ms | 308 KB | Output is partially correct |
22 | Partially correct | 169 ms | 208 KB | Output is partially correct |
23 | Partially correct | 175 ms | 312 KB | Output is partially correct |
24 | Partially correct | 111 ms | 348 KB | Output is partially correct |
25 | Partially correct | 98 ms | 336 KB | Output is partially correct |
26 | Partially correct | 94 ms | 348 KB | Output is partially correct |
27 | Partially correct | 173 ms | 304 KB | Output is partially correct |
28 | Partially correct | 151 ms | 304 KB | Output is partially correct |
29 | Partially correct | 195 ms | 208 KB | Output is partially correct |
30 | Partially correct | 98 ms | 208 KB | Output is partially correct |
31 | Partially correct | 140 ms | 328 KB | Output is partially correct |
32 | Partially correct | 179 ms | 308 KB | Output is partially correct |
33 | Partially correct | 155 ms | 208 KB | Output is partially correct |
34 | Partially correct | 176 ms | 208 KB | Output is partially correct |
35 | Partially correct | 118 ms | 308 KB | Output is partially correct |
36 | Partially correct | 154 ms | 300 KB | Output is partially correct |
37 | Partially correct | 190 ms | 300 KB | Output is partially correct |
38 | Partially correct | 188 ms | 308 KB | Output is partially correct |
39 | Partially correct | 185 ms | 312 KB | Output is partially correct |
40 | Partially correct | 159 ms | 308 KB | Output is partially correct |
41 | Partially correct | 206 ms | 308 KB | Output is partially correct |
42 | Partially correct | 141 ms | 304 KB | Output is partially correct |
43 | Partially correct | 31 ms | 256 KB | Output is partially correct |
44 | Partially correct | 86 ms | 208 KB | Output is partially correct |
45 | Partially correct | 190 ms | 208 KB | Output is partially correct |
46 | Partially correct | 96 ms | 332 KB | Output is partially correct |
47 | Partially correct | 108 ms | 336 KB | Output is partially correct |
48 | Partially correct | 73 ms | 332 KB | Output is partially correct |