This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define ONLINE_JUDGE
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0, _n = n; i < _n; ++i)
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define FORE(it, s) for (__typeof(s.begin()) it = (s).begin(); it != (s).end(); ++it)
template <class U, class V> bool maximize(U &A, const V &B) { return (A < B) ? (A = B, true) : false; }
template <class U, class V> bool minimize(U &A, const V &B) { return (A > B) ? (A = B, true) : false; }
set <int> inside;
vector <int> insect;
/*
void add(int i) {
inside.insert(i);
move_inside(i);
}
void del(int i) {
inside.erase(inside.find(i));
move_outside(i);
}
*/
int min_cardinality(int n) {
insect.assign(n, 0);
iota(ALL(insect), 0);
int ans = n;
REP(i, n) {
int cur = 1;
stack <int> st;
move_inside(insect[i]);
st.push(insect[i]);
REP(j, n) if(j != i) {
move_inside(insect[j]);
if(press_button() == cur + 1) cur++, st.push(insect[j]);
else move_outside(insect[j]);
}
minimize(ans, cur);
while((int) st.size() > 0) move_outside(st.top()), st.pop();
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |