# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078043 | 2024-08-27T11:53:57 Z | pcc | Rarest Insects (IOI22_insects) | C++17 | 31 ms | 640 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; const int mxn = 2022; vector<int> v[mxn]; set<int> st; int N; int cnt = 0; const int B = 4; int mx[mxn]; void del(int k){ assert(st.find(k) != st.end()); st.erase(k); move_outside(k); return; } void add(int k){ assert(st.find(k) == st.end()); st.insert(k); move_inside(k); return; } int ask(){ int re = press_button(); return re; } bool check(int lim){ for(int i = lim+1;i<=N;i++){ while(!v[i].empty()){ auto now = v[i].back(); v[i].pop_back(); del(now); } } for(int i = 0;i<N;i++){ if(mx[i]>lim)continue; if(st.find(i) == st.end()){ add(i); int re = ask(); mx[i] = max(mx[i],re); if(re>lim)del(i); else v[re].push_back(i); } } return lim*cnt == st.size(); } int brute(int N,int cnt){ } int min_cardinality(int NN) { N = NN; check(1); cnt = st.size(); if(N/cnt<=B){ return brute(N,cnt); } int l = 1,r = N/cnt; while(l != r){ int mid = (l+r+1)>>1; if(check(mid))l = mid; else r = mid-1; } return l; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 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 | Incorrect | 2 ms | 344 KB | Wrong answer. |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 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 | Incorrect | 2 ms | 344 KB | Wrong answer. |
10 | 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 | 1 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 | 340 KB | Output is correct |
7 | Correct | 31 ms | 600 KB | Output is correct |
8 | Correct | 10 ms | 344 KB | Output is correct |
9 | Correct | 26 ms | 344 KB | Output is correct |
10 | Correct | 20 ms | 536 KB | Output is correct |
11 | Correct | 26 ms | 480 KB | Output is correct |
12 | Correct | 13 ms | 344 KB | Output is correct |
13 | Incorrect | 14 ms | 640 KB | Wrong answer. |
14 | Halted | 0 ms | 0 KB | - |