# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1058298 | 2024-08-14T09:15:45 Z | Dan4Life | Rarest Insects (IOI22_insects) | C++17 | 206 ms | 412 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a), end(a) using vi = vector<int>; int D, inside[3000]; int min_cardinality(int n) { for(int i = 0; i < n; i++){ move_inside(i); if(press_button()>1) move_outside(i); else inside[i]=1, D++; } if(D==1) return n; if(D==n) return 1; int l = 1, r = n/D, p=1, tot=D; while(l<r){ int mid = (l+r+1)/1.9; for(int i = 0; i < n; i++) if(inside[i] >= mid and mid<=p) move_outside(i), inside[i]=0, tot--; for(int i = 0; i < n; i++){ if(!!inside[i] or tot==D*mid) continue; move_inside(i); if(press_button()>mid) move_outside(i); else inside[i]=mid, tot++; } if(tot==D*mid) l = mid; else{ for(int i = 0; i < n; i++) if(!inside[i]) inside[i]=-1; r=mid-1; } p=mid; } return l; }
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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Incorrect | 205 ms | 344 KB | Too many queries. |
15 | Halted | 0 ms | 0 KB | - |
# | 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Incorrect | 205 ms | 344 KB | Too many queries. |
15 | Halted | 0 ms | 0 KB | - |
# | 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 | 0 ms | 344 KB | Output is correct |
7 | Correct | 7 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 344 KB | Output is correct |
9 | Incorrect | 206 ms | 412 KB | Too many queries. |
10 | Halted | 0 ms | 0 KB | - |