# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658598 | pere_gil | Rarest Insects (IOI22_insects) | C++17 | 361 ms | 304 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 "insects.h"
#include "bits/stdc++.h"
using namespace std;
void pri(vector<int> v){
for(int x: v) printf("%d ",x);
printf("\n");
}
void get(vector<int> &u, vector<int> &r){
vector<int> unique;
for(int x: u){
move_inside(x);
if(press_button()==2){
move_outside(x);
r.push_back(x);
}
else unique.push_back(x);
}
for(int x: unique) move_outside(x);
u=unique;
}
int min_cardinality(int n) {
vector<int> u(n),r;
iota(u.begin(),u.end(),0);
get(u,r);
int prev=u.size();
u=r; r.clear();
int res=1;
for(;res<n;res++){
get(u,r);
if(u.size()<prev) break;
prev=u.size();
u=r; r.clear();
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |