Submission #787699

#TimeUsernameProblemLanguageResultExecution timeMemory
787699AndreyRarest Insects (IOI22_insects)C++17
50 / 100
148 ms400 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; int n,p = 0; bool check(int a) { vector<bool> bruh(n,true); int br = n; for(int i = 0; i < n; i++) { move_inside(i); if(press_button() > a) { bruh[i] = false; move_outside(i); br--; } } for(int i = 0; i < n; i++) { if(bruh[i]) { move_outside(i); } } if(br == p*a) { return false; } else { return true; } } int min_cardinality(int N) { n = N; int l = 1,m,r; vector<bool> bruh(n,true); for(int i = 0; i < n; i++) { move_inside(i); if(press_button() > 1) { move_outside(i); bruh[i] = false; } else { p++; } } r = n/p; if(p == 1) { return n; } for(int i = 0; i < n; i++) { if(bruh[i]) { move_outside(i); } } while(l < r) { m = (l+r+1)/2; if(check(m)) { r = m-1; } else { l = m; } } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...