Submission #1071708

#TimeUsernameProblemLanguageResultExecution timeMemory
1071708c2zi6Rarest Insects (IOI22_insects)C++17
10 / 100
250 ms600 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "insects.h" mt19937 rng; VI rngind; void movein(int i) { move_inside(rngind[i]); } void moveout(int i) { move_outside(rngind[i]); } int min_cardinality(int n) { rng = mt19937(chrono::steady_clock().now().time_since_epoch().count()); rngind = VI(n); rep(i, n) rngind[i] = i; shuffle(all(rngind), rng); VI a(n, -1); int last = 0; replr(i, 0, n-1) if (a[i] == -1) { a[i] = last; movein(i); replr(j, i+1, n-1) if (a[j] == -1) { movein(j); if (press_button() == 2) a[j] = a[i]; moveout(j); } moveout(i); last++; } /*for (int x : a) cout << x << " "; cout << endl;*/ VI cnt(n); for (int x : a) cnt[x]++; int ans = 2e9; for (int x : cnt) if (x) setmin(ans, x); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...