# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962050 | cnn008 | Rarest Insects (IOI22_insects) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#ifdef N_N_C
#include "debug.h"
#else
#define cebug(...) "Arya"
#endif
#define int long long
const int N=2005;
const int mod=1e9+7;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
assert(l<=r);
return uniform_int_distribution<int> (l,r)(rng);
}
set <int> s;
int f=1;
int n,T[N];
void move_inside(int i){
s.insert(T[i]);
if(s.find(T[i])!=s.end()) f=2;
}
void move_outside(int i){
s.erase(s.find(T[i]));
f=1;
}
int press_buton(){
return f;
}
int min_cardinality(int n){
int type=0;
for(int i=0; i<n; i++){
move_inside(i);
press_buton();
if(press_buton()==1){
type++;
move_outside(i);
}
}
return rand(1,n/type);
}