제출 #1212128

#제출 시각아이디문제언어결과실행 시간메모리
1212128LemserRarest Insects (IOI22_insects)C++20
50 / 100
54 ms448 KiB
#include "insects.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") #pragma GCC target("popcnt") using namespace std; using ll = long long; using ull = unsigned long long; using lld = long double; using ii = pair<int,int>; using pll = pair<ll, ll>; using vi = vector<int>; using vll = vector<ll>; using vii = vector<ii>; using vpll = vector<pll>; using vlld = vector<lld>; #define all(x) x.begin(),x.end() #define lsb(x) x&(-x) #define gcd(a,b) __gcd(a,b) #define sz(x) (int)x.size() #define mp make_pair #define pb push_back #define fi first #define se second #define fls cout.flush() #define fore(i, l, r) for (auto i = l; i < r; i++) #define fo(i, n) fore (i, 0, n) #define forex(i, r, l) for (auto i = r-1; i >= l; i--) #define ffo(i, n) forex (i, n, 0) bool cmin(ll &a, ll b) { if (b < a) { a=b; return 1; } return 0; } bool cmax(ll &a, ll b) { if (b > a) { a=b; return 1; } return 0; } /* void move_inside(i) void move_outside(i) ll press_button() */ int min_cardinality(int n) { vll A; fo (i, n) { move_inside(i); if (press_button() == 2) { move_outside(i); continue; } A.pb(i); } for (ll i: A) move_outside(i); if (A.size() == 1) return n; ll l = 2, r = n/A.size(); while (l <= r) { ll m = (l+r)/2; vll ok; fo (i, n) { move_inside(i); if (press_button() > m) { move_outside(i); } else ok.push_back(i); } if (ok.size() == A.size()*m) l = m+1; else r = m-1; for (ll i: ok) move_outside(i); } return r; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...