Submission #1203414

#TimeUsernameProblemLanguageResultExecution timeMemory
1203414HappyCapybaraRarest Insects (IOI22_insects)C++17
50 / 100
55 ms416 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; int min_cardinality(int N){ vector<bool> in(N, false); int t = 0; for (int i=0; i<N; i++){ move_inside(i); in[i] = true; t++; if (press_button() > 1){ move_outside(i); in[i] = false; t--; } } if (t == 1) return N; int l = 1, r = N/t+1; while (l < r-1){ int m = (l+r)/2; for (int i=0; i<N; i++){ if (in[i]) move_outside(i); in[i] = false; } int k = 0; for (int i=0; i<N; i++){ move_inside(i); in[i] = true; k++; if (press_button() > m){ move_outside(i); in[i] = false; k--; } } if (k == t*m) l = m; else r = m; } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...