# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078263 | 2024-08-27T14:37:48 Z | Faisal_Saqib | Rarest Insects (IOI22_insects) | C++17 | 739 ms | 21788 KB |
#include <bits/stdc++.h> using namespace std; void move_inside(int i); void move_outside(int i); int press_button(); set<int> machine,rem,real_; void add(int x) { if(machine.find(x)==machine.end()) { machine.insert(x); } } void remp(int x) { if(machine.find(x)!=machine.end()) { machine.erase(x); } } map<vector<int>,int> store; int ask() { vector<int> cur(begin(machine),end(machine)); if(store.find(cur)!=store.end()) return store[cur]; for(auto&i:real_) if(machine.find(i)==machine.end()) move_outside(i); for(auto&i:machine) if(real_.find(i)==real_.end()) move_inside(i); real_=machine; return store[cur]=press_button(); } int min_cardinality(int n) { add(0); for(int i=1;i<n;i++) { add(i); if(ask()>1) { rem.insert(i); remp(i); } } int sz=machine.size(); int s=1; int e=(n/sz)+1; while(s+1<e) { int mid=(s+e)/2; vector<int> cur; for(auto&i:rem) { if(machine.size()==(sz*mid)) break; add(i); if(ask()>mid) { remp(i); } else { cur.push_back(i); if(machine.size()==(sz*mid)) break; } } if(machine.size()==((sz*mid))) { s=mid; for(auto&i:cur) rem.erase(i); } else{ e=mid; rem.clear(); for(auto&i:cur) { rem.insert(i); remp(i); } } } return s; }
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 | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 4 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 600 KB | Output is correct |
9 | Correct | 5 ms | 600 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 4 ms | 476 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
14 | Correct | 5 ms | 452 KB | Output is correct |
15 | Correct | 7 ms | 600 KB | Output is correct |
16 | Correct | 6 ms | 604 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 5 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 460 KB | Output is correct |
20 | Correct | 4 ms | 568 KB | Output is correct |
21 | Correct | 5 ms | 600 KB | Output is correct |
22 | Correct | 2 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 | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 4 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 600 KB | Output is correct |
9 | Correct | 5 ms | 600 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 4 ms | 476 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
14 | Correct | 5 ms | 452 KB | Output is correct |
15 | Correct | 7 ms | 600 KB | Output is correct |
16 | Correct | 6 ms | 604 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 5 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 460 KB | Output is correct |
20 | Correct | 4 ms | 568 KB | Output is correct |
21 | Correct | 5 ms | 600 KB | Output is correct |
22 | Correct | 2 ms | 344 KB | Output is correct |
23 | Correct | 44 ms | 3032 KB | Output is correct |
24 | Correct | 43 ms | 2896 KB | Output is correct |
25 | Correct | 76 ms | 3892 KB | Output is correct |
26 | Correct | 94 ms | 4516 KB | Output is correct |
27 | Correct | 36 ms | 2604 KB | Output is correct |
28 | Correct | 32 ms | 1360 KB | Output is correct |
29 | Correct | 42 ms | 2048 KB | Output is correct |
30 | Correct | 54 ms | 2760 KB | Output is correct |
31 | Correct | 76 ms | 3868 KB | Output is correct |
32 | Correct | 75 ms | 3900 KB | Output is correct |
33 | Correct | 93 ms | 4540 KB | Output is correct |
34 | Correct | 95 ms | 4116 KB | Output is correct |
35 | Correct | 97 ms | 3996 KB | Output is correct |
36 | Correct | 87 ms | 3920 KB | Output is correct |
37 | Correct | 86 ms | 4064 KB | Output is correct |
38 | Correct | 63 ms | 3152 KB | Output is correct |
39 | Correct | 57 ms | 3152 KB | Output is correct |
40 | Correct | 56 ms | 3156 KB | Output is correct |
41 | Correct | 47 ms | 2060 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 | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 285 ms | 10608 KB | Output is correct |
8 | Correct | 262 ms | 10064 KB | Output is correct |
9 | Correct | 539 ms | 15500 KB | Output is correct |
10 | Correct | 467 ms | 15516 KB | Output is correct |
11 | Correct | 112 ms | 4784 KB | Output is correct |
12 | Correct | 181 ms | 8780 KB | Output is correct |
13 | Correct | 156 ms | 7096 KB | Output is correct |
14 | Correct | 213 ms | 8844 KB | Output is correct |
15 | Correct | 395 ms | 12948 KB | Output is correct |
16 | Correct | 450 ms | 13828 KB | Output is correct |
17 | Correct | 441 ms | 13864 KB | Output is correct |
18 | Correct | 580 ms | 16112 KB | Output is correct |
19 | Correct | 483 ms | 15236 KB | Output is correct |
20 | Correct | 511 ms | 15416 KB | Output is correct |
21 | Correct | 505 ms | 15412 KB | Output is correct |
22 | Correct | 298 ms | 12776 KB | Output is correct |
23 | Correct | 242 ms | 9808 KB | Output is correct |
24 | Correct | 358 ms | 12992 KB | Output is correct |
25 | Correct | 324 ms | 11532 KB | Output is correct |
26 | Correct | 164 ms | 7052 KB | Output is correct |
27 | Correct | 609 ms | 19848 KB | Output is correct |
28 | Correct | 258 ms | 10040 KB | Output is correct |
29 | Correct | 691 ms | 20856 KB | Output is correct |
30 | Correct | 705 ms | 20828 KB | Output is correct |
31 | Correct | 440 ms | 14804 KB | Output is correct |
32 | Correct | 504 ms | 16236 KB | Output is correct |
33 | Correct | 207 ms | 9196 KB | Output is correct |
34 | Correct | 262 ms | 9064 KB | Output is correct |
35 | Partially correct | 714 ms | 21416 KB | Output is partially correct |
36 | Correct | 574 ms | 16416 KB | Output is correct |
37 | Correct | 449 ms | 14668 KB | Output is correct |
38 | Correct | 429 ms | 14808 KB | Output is correct |
39 | Correct | 613 ms | 19420 KB | Output is correct |
40 | Correct | 287 ms | 10648 KB | Output is correct |
41 | Correct | 563 ms | 16704 KB | Output is correct |
42 | Partially correct | 739 ms | 21788 KB | Output is partially correct |
43 | Correct | 10 ms | 856 KB | Output is correct |
44 | Correct | 85 ms | 3188 KB | Output is correct |
45 | Correct | 288 ms | 10848 KB | Output is correct |
46 | Correct | 129 ms | 6988 KB | Output is correct |
47 | Correct | 241 ms | 10832 KB | Output is correct |
48 | Correct | 178 ms | 8832 KB | Output is correct |