Submission #858737

#TimeUsernameProblemLanguageResultExecution timeMemory
858737temporary1Rarest Insects (IOI22_insects)C++17
10 / 100
218 ms1236 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int cnt; set<int> st; vector<int> due; int min_cardinality(int n) { move_inside(0); cnt = 1; int k; for (int i = 1; i < n; ++i) { move_inside(i); k = press_button(); if (k == 1) { ++cnt; } else { move_outside(i); st.insert(i); } } if (cnt == 1) { return n; } int max1 = (n-k)/(cnt-1); for (int i = 2; i <= max1; ++i) { int curcnt = 0; /*printf("%d\n",i); for (auto it : st) { printf("%d ",it); } printf("\n");*/ for (auto it : st) { move_inside(it); if (press_button() == i) { due.push_back(it); ++curcnt; } else { move_outside(it); } } if (curcnt < cnt) { return i-1; } for (auto it : due) { st.erase(it); } } return max1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...