Submission #979657

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9796572024-05-11 09:32:4212345678Rarest Insects (IOI22_insects)C++17
100 / 100
33 ms1268 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=2e3+5;
mt19937 rng(time(0));
int p[nx], cnt, sz, in[nx], t[nx], s[nx];
vector<pair<int, int>> v;
int min_cardinality(int N) {
cin.tie(NULL)->sync_with_stdio(false);
for (int i=0; i<N; i++) v.push_back({rng(), i});
sort(v.begin(), v.end());
for (int i=0; i<N; i++) p[v[i].second]=i;
for (int i=0; i<N; i++)
{
move_inside(p[i]);
if (press_button()==1) cnt++, in[i]=1, s[i]=1;
else move_outside(p[i]);
}
if (cnt==1) return N;
if (cnt==N) return 1;
int l=1, r=N/cnt;
sz=cnt;
while (l<r)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...