# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078159 | 2024-08-27T13:26:24 Z | Muhammad_Aneeq | Rarest Insects (IOI22_insects) | C++17 | 2000 ms | 153700 KB |
void move_inside(int i); void move_outside(int i); int press_button(); #include <iostream> #include <vector> #include <map> #include <set> using namespace std; map<set<int>,int>d; set<int>ind; int ask() { if (d.find(ind)!=d.end()) return d[ind]; d[ind]=press_button(); return d[ind]; } int min_cardinality(int N) { int colors=0; for (int i=0;i<N;i++) { move_inside(i); ind.insert(i); if (ask()==2) { move_outside(i); ind.erase(i); } else colors++; } set<int>ni; for (int i=0;i<N;i++) if (ind.find(i)==ind.end()) ni.insert(i); if (colors==1) return N; int st=1,en=N/colors+1; while (st+1<en) { int mid=(st+en)/2; for (auto i:ni) { if (ind.size()==colors*mid) break; move_inside(i); ind.insert(i); if (ask()>mid) { move_outside(i); ind.erase(i); } } if (ind.size()==mid*colors) { for (auto i:ind) ni.erase(i); st=mid; } else { en=mid; for (auto i:ind) { ni.insert(i); move_outside(i); } ind.clear(); } } return st; }
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 | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 6 ms | 1368 KB | Output is correct |
8 | Correct | 16 ms | 1880 KB | Output is correct |
9 | Correct | 13 ms | 2068 KB | Output is correct |
10 | Correct | 12 ms | 1368 KB | Output is correct |
11 | Correct | 4 ms | 856 KB | Output is correct |
12 | Correct | 14 ms | 1820 KB | Output is correct |
13 | Correct | 12 ms | 2028 KB | Output is correct |
14 | Correct | 18 ms | 2648 KB | Output is correct |
15 | Correct | 17 ms | 2648 KB | Output is correct |
16 | Correct | 15 ms | 2812 KB | Output is correct |
17 | Correct | 19 ms | 2904 KB | Output is correct |
18 | Correct | 14 ms | 2136 KB | Output is correct |
19 | Correct | 20 ms | 2392 KB | Output is correct |
20 | Correct | 11 ms | 2056 KB | Output is correct |
21 | Correct | 10 ms | 1884 KB | Output is correct |
22 | Correct | 6 ms | 1112 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 | 6 ms | 1368 KB | Output is correct |
8 | Correct | 16 ms | 1880 KB | Output is correct |
9 | Correct | 13 ms | 2068 KB | Output is correct |
10 | Correct | 12 ms | 1368 KB | Output is correct |
11 | Correct | 4 ms | 856 KB | Output is correct |
12 | Correct | 14 ms | 1820 KB | Output is correct |
13 | Correct | 12 ms | 2028 KB | Output is correct |
14 | Correct | 18 ms | 2648 KB | Output is correct |
15 | Correct | 17 ms | 2648 KB | Output is correct |
16 | Correct | 15 ms | 2812 KB | Output is correct |
17 | Correct | 19 ms | 2904 KB | Output is correct |
18 | Correct | 14 ms | 2136 KB | Output is correct |
19 | Correct | 20 ms | 2392 KB | Output is correct |
20 | Correct | 11 ms | 2056 KB | Output is correct |
21 | Correct | 10 ms | 1884 KB | Output is correct |
22 | Correct | 6 ms | 1112 KB | Output is correct |
23 | Correct | 7 ms | 600 KB | Output is correct |
24 | Correct | 244 ms | 24036 KB | Output is correct |
25 | Correct | 362 ms | 36744 KB | Output is correct |
26 | Correct | 868 ms | 83756 KB | Output is correct |
27 | Correct | 256 ms | 23320 KB | Output is correct |
28 | Correct | 104 ms | 12112 KB | Output is correct |
29 | Correct | 384 ms | 34932 KB | Output is correct |
30 | Correct | 448 ms | 44236 KB | Output is correct |
31 | Correct | 622 ms | 53628 KB | Output is correct |
32 | Correct | 995 ms | 70228 KB | Output is correct |
33 | Correct | 1012 ms | 83188 KB | Output is correct |
34 | Correct | 719 ms | 63444 KB | Output is correct |
35 | Correct | 622 ms | 57620 KB | Output is correct |
36 | Correct | 646 ms | 60508 KB | Output is correct |
37 | Correct | 606 ms | 59984 KB | Output is correct |
38 | Correct | 412 ms | 43808 KB | Output is correct |
39 | Correct | 323 ms | 38232 KB | Output is correct |
40 | Correct | 281 ms | 29948 KB | Output is correct |
41 | Correct | 172 ms | 17476 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 | 0 ms | 344 KB | Output is correct |
7 | Correct | 11 ms | 1016 KB | Output is correct |
8 | Correct | 1608 ms | 94552 KB | Output is correct |
9 | Execution timed out | 2518 ms | 153700 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |