# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658595 | pere_gil | Rarest Insects (IOI22_insects) | C++17 | 1 ms | 208 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(queue<int> q){
printf(": ");
while(!q.empty()){
printf("%d ",q.front()); q.pop();
}
printf("\n");
}
queue<int> get(queue<int> &q){
queue<int> in,out;
while(!q.empty()){
int u=q.front(); q.pop();
move_inside(u);
if(press_button()==1) in.push(u);
else{
out.push(u);
move_outside(u);
}
}
while(!in.empty()){
move_outside(in.front()); in.pop();
}
return out;
}
int min_cardinality(int n) {
queue<int> q;
for(int i=0;i<n;i++) q.push(i);
q=get(q);
int prev=q.size();
int res;
for(res=1;res<n;res++){
q=get(q);
if(prev!=q.size()) break;
prev=q.size();
}
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... |