Submission #627829

#TimeUsernameProblemLanguageResultExecution timeMemory
627829tutisRarest Insects (IOI22_insects)C++17
47.50 / 100
247 ms544 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(vector<int> x) { auto cnt = [&](int c)->int { vector<int>v; for (int i : x) { v.push_back(i); move_inside(i); int k = press_button(); if (k == c + 1) { v.pop_back(); move_outside(i); } } int r = v.size(); for (int i : v) move_outside(i); return r; }; int c = cnt(1); int lo = 1; int hi = (int)x.size(); while (lo < hi) { int m = (lo + hi + 1) / 2; int k = cnt(m); if (k == m * c) lo = m; else hi = m - 1; } return lo; } int min_cardinality(int N) { vector<int>v; for (int i = 0; i < N; i++) v.push_back(i); return min_cardinality(v); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...