제출 #1077045

#제출 시각아이디문제언어결과실행 시간메모리
1077045mariaclara드문 곤충 (IOI22_insects)C++17
50.01 / 100
130 ms672 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define mk make_pair #define pb push_back #define fr first #define sc second int min_cardinality(int N) { vector<int> in(N); int colors = 0; for(int i = 0; i < N; i++) { move_inside(i); in[i] = 1; if(press_button() == 2) move_outside(i), in[i] = 0; else colors++; } int l = 1, r = N/colors; while(l <= r) { int mid = (l+r)/2, qtd = 0; for(int i = 0; i < N; i++) { if(in[i]) {qtd++; continue;} in[i] = 1; move_inside(i); if(press_button() > mid) move_outside(i), in[i] = 0; else qtd++; } if(qtd == colors*mid) l = mid+1; else { r = mid-1; for(int i = 0; i < N; i++) if(in[i]) move_outside(i), in[i] = 0; } } return l-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...