# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
824274 | 2023-08-13T22:57:11 Z | boyliguanhan | Rarest Insects (IOI22_insects) | C++17 | 1 ms | 208 KB |
#include "insects.h" #include<bits/stdc++.h> using namespace std; int min_cardinality(int N) { vector<pair<int, int>> groups{{1,0}}; for(int i = 1; i < N; i++) { int mv=1e9,mc; for(auto j:groups) if(j.first<mv) mv=j.first,mc=1; else if(j.first==mv) mc++; if(mc>N-i) { return mv; } vector<int> v; move_inside(i); for(auto i: groups) v.push_back(i.second), move_inside(i.second); int x = press_button(); for(auto i: v) move_outside(i); if(x-1) { int l = 0, r = v.size()-1; while(l<r) { int mid = l+r>>1; for(int j = l; j <= mid; j++) move_inside(v[i]); x = press_button(); for(int j = l; j <= mid; j++) move_outside(v[i]); if(x-1) { r = mid; } else { l = mid+1; } } groups[l].first++; } else groups.push_back({1,i}); move_outside(i); } return min_element(groups.begin(), groups.end())->first; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 0 ms | 208 KB | Integer 4113 violates the range [0, 7] |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 0 ms | 208 KB | Integer 4113 violates the range [0, 7] |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Incorrect | 0 ms | 208 KB | Integer 4113 violates the range [0, 9] |
7 | Halted | 0 ms | 0 KB | - |