제출 #627775

#제출 시각아이디문제언어결과실행 시간메모리
627775ETK드문 곤충 (IOI22_insects)C++17
10 / 100
355 ms208 KiB
#include <bits/stdc++.h> #include "insects.h" #define rep(i,a,b) for(int i=(a);i<=(b);++i) #define per(i,a,b) for(int i=(a);i>=(b);--i) #define pii pair<int,int> #define vi vector<int> #define fi first #define se second #define pb push_back #define ALL(x) x.begin(),x.end() #define sz(x) int(x.size()) #define ll long long using namespace std; const int N = 2e5 + 5; int n,a[N],b[N]; // void move_inside(int i){ // ++b[a[i]]; // } // void move_outside(int i){ // --b[a[i]]; // } // int press_button(){ // int mx = 0; // rep(i,1,n)mx = max(mx,b[i]); // return mx; // } int min_cardinality(int n){ int cnt = 0; vi vis(n,0); rep(i,0,n - 1){ move_inside(i); //appeared before if(press_button() > 1)move_outside(i); else vis[i] = 1,cnt++; } int tmp = cnt; rep(k,2,n){ rep(i,0,n - 1){ if(vis[i])continue; move_inside(i); if(press_button() > k)move_outside(i); else vis[i] = 1,tmp++; } if(tmp < k * cnt){ return k - 1; } } return n; } // int main(){ // cin >> n; // rep(i,0,n - 1)cin >> a[i]; // cout << min_cardinality(n) << '\n'; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...