# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070710 | Mihailo | 드문 곤충 (IOI22_insects) | C++17 | 165 ms | 592 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>
#define mp make_pair
#define pb push_back
#define pll pair<long long, long long>
#define MOD 1000002022ll
#define xx first
#define yy second
using namespace std;
typedef long long ll;
void move_inside(int i);
void move_outside(int i);
int press_button();
vector<int> rep;
set<int> setrep;
int tip[10000], bp[10000];
int min_cardinality(int N) {
for(int i=0; i<N; i++) {
move_inside(i);
if(press_button()>1) move_outside(i);
else {
rep.pb(i);
setrep.insert(i);
}
}
for(int i=0; i<rep.size(); i++) tip[rep[i]]=i;
for(int i=0; i<rep.size(); i++) {
if(i%2==0) move_outside(rep[i]);
}
for(int i=0; i<N; i++) {
if(!setrep.count(i)) {
move_inside(i);
if(press_button()==2) tip[i]+=1;
move_outside(i);
}
}
for(int b=1; b<=10; b++) {
for(int i=0; i<rep.size(); i++) {
if(i&(1<<(b-1))&&!(i&(1<<(b)))) move_outside(i);
if(!(i&(1<<(b-1)))&&i&(1<<(b))) move_inside(i);
}
for(int i=0; i<N; i++) {
if(!setrep.count(i)) {
move_inside(i);
if(press_button()==2) tip[i]+=(1<<b);
move_outside(i);
}
}
}
for(int i=0; i<N; i++) bp[tip[i]]++;
ll rez=MOD;
for(int i=0; i<rep.size(); i++) rez=min(rez, (ll)bp[i]);
return rez;
}
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... |