Submission #741969

#TimeUsernameProblemLanguageResultExecution timeMemory
741969fanwenRarest Insects (IOI22_insects)C++17
10 / 100
354 ms336 KiB
#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); } */ void print_vector(vector <int> v) { for (auto x : v) cout << x << " "; cout << '\n'; } int min_cardinality(int n) { insect.assign(n, 0); iota(ALL(insect), 0); set <int> s; int ans = 0; int D = 0; REP(i, n) { move_inside(i); D++; if(press_button() > 1) move_outside(i), --D; } if(2 * D > n) return 1; vector <int> List; REP(i, n) List.push_back(i); while((int) List.size()) { ans++; vector <int> newList; vector <int> Del; int val = 0; REP(i, (int) List.size()) { int x = List[i]; move_inside(x); val++; if(press_button() > 1) { move_outside(x); newList.push_back(x); val--; } else Del.push_back(x); } for (auto x : Del) move_outside(x); List = newList; if(val != D) return ans - 1; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...