# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
628166 | sword060 | Rarest Insects (IOI22_insects) | C++17 | 0 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 <bits/stdc++.h>
#include "insects.h"
using namespace std;
void move_inside(int);
void move_outside(int);
int press_button();
int min_cardinality(int x) {
map<int,int>mp;
int ans=1e9,lst=1;
for(int i=0;i<x;i++)move_inside(i);
int z=press_button();
ans=z;
while(mp.size()!=x){
for(int i=0;i<x;i++){
if(mp[i])continue;
move_outside(i);
int c=press_button();
if(c!=z){
mp[i]=1;
for(int j=i-1;j>=0;j--){
move_inside(j);
if(press_button()!=c){
mp[j]=1;
}else{
move_inside(j);
}
}
z=c;ans=min(ans,c);
break;
}
}
}
return ans;
}
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... |