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;
int cnt;
set<int> st;
vector<int> due;
int min_cardinality(int n) {
move_inside(0);
cnt = 1;
int k;
for (int i = 1; i < n; ++i) {
move_inside(i);
k = press_button();
if (k == 1) {
++cnt;
} else {
move_outside(i);
st.insert(i);
}
}
if (cnt == 1) {
return n;
}
int max1 = (n-k)/(cnt-1);
for (int i = 2; i <= max1; ++i) {
int curcnt = 0;
/*printf("%d\n",i);
for (auto it : st) {
printf("%d ",it);
}
printf("\n");*/
for (auto it : st) {
move_inside(it);
if (press_button() == i) {
due.push_back(it);
++curcnt;
} else {
move_outside(it);
}
}
if (curcnt < cnt) {
return i-1;
}
for (auto it : due) {
st.erase(it);
}
}
return max1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |