# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060138 | 2024-08-15T10:56:08 Z | parsadox2 | Rarest Insects (IOI22_insects) | C++17 | 245 ms | 596 KB |
#include <bits/stdc++.h> #include "insects.h" using namespace std; const int N = 2e3 + 10 , Lg = 10; int n , ans; bool bad[N] , dead[N]; bool check(int mid) { int all = 0; for(int i = 0 ; i < n ; i++) if(!dead[i]) { bad[i] = false; all++; move_inside(i); int val = press_button(); if(val > mid) { bad[i] = true; move_outside(i); } } for(int i = 0 ; i < n ; i++) if(!bad[i] && !dead[i]) move_outside(i); bool flg = true; vector <int> vec; int cnt = 0; for(int i = 0 ; i < n ; i++) if(bad[i] && !dead[i]) { flg = false; move_inside(i); int val = press_button(); if(val > 1) { move_outside(i); cnt++; } else { cnt += (mid + 1); vec.push_back(i); } } for(auto u : vec) { move_outside(u); } //cout << mid << " : " << cnt << " " << all << endl; if(cnt == all) { for(int i = 0 ; i < n ; i++) if(!dead[i] && !bad[i]) dead[i] = true; return false; } for(int i = 0 ; i < n ; i++) if(bad[i] && !dead[i]) dead[i] = true; return true; } int min_cardinality(int nn) { n = nn; while(!check(1)) { ans++; } return ans + 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 596 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 204 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 18 ms | 344 KB | Output is correct |
9 | Correct | 11 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 2 ms | 344 KB | Output is correct |
14 | Correct | 61 ms | 344 KB | Output is correct |
15 | Correct | 34 ms | 344 KB | Output is correct |
16 | Correct | 15 ms | 344 KB | Output is correct |
17 | Correct | 22 ms | 344 KB | Output is correct |
18 | Correct | 4 ms | 344 KB | Output is correct |
19 | Correct | 11 ms | 344 KB | Output is correct |
20 | Correct | 2 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 596 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 204 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 18 ms | 344 KB | Output is correct |
9 | Correct | 11 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 2 ms | 344 KB | Output is correct |
14 | Correct | 61 ms | 344 KB | Output is correct |
15 | Correct | 34 ms | 344 KB | Output is correct |
16 | Correct | 15 ms | 344 KB | Output is correct |
17 | Correct | 22 ms | 344 KB | Output is correct |
18 | Correct | 4 ms | 344 KB | Output is correct |
19 | Correct | 11 ms | 344 KB | Output is correct |
20 | Correct | 2 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Incorrect | 243 ms | 344 KB | Too many queries. |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | Partially correct | 1 ms | 344 KB | Output is partially correct |
7 | Incorrect | 245 ms | 344 KB | Too many queries. |
8 | Halted | 0 ms | 0 KB | - |