Submission #1024659

#TimeUsernameProblemLanguageResultExecution timeMemory
1024659mansurRarest Insects (IOI22_insects)C++17
10 / 100
249 ms1104 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; #define rall(s) s.rbegin(), s.rend() #define all(s) s.begin(), s.end() #define sz(s) (int) s.size() #define s second #define f first using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; mt19937_64 rng(131415889); int min_cardinality(int n) { vector<pair<int, vector<int>>> s; vector<int> p(n); for (int i = 0; i < n; i++) p[i] = i; shuffle(all(p), rng); s.push_back({1, {p[0]}}); move_inside(p[0]); for (int i = 1; i < n; i++) { move_inside(p[i]); if (press_button() > 1) { bool ok = 0; sort(rall(s)); for (int j = 0; j < sz(s); j++) { move_outside(s[j].s.back()); if (press_button() == 1) { s[j].s.push_back(p[i]); s[j].f++; ok = 1; break; } move_inside(s[j].s.back()); } if (!ok) move_outside(p[i]); continue; } s.push_back({1, {p[i]}}); } sort(all(s)); return s[0].f; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...