제출 #1135054

#제출 시각아이디문제언어결과실행 시간메모리
1135054Saul0906드문 곤충 (IOI22_insects)C++20
0 / 100
0 ms412 KiB
#include "insects.h" #include <vector> #include <bits/stdc++.h> #define rep(a,b,c) for(ll a=b; a<c; a++) #define repr(a,b,c) for(ll a=b-1; a>c-1; a--) #define repa(a,b) for(auto a:b) #define ll long long #define pll pair<ll, ll> #define fi first #define se second #define pb push_back #define mid ((l+r)>>1) #define ppb pop_back() using namespace std; using vi = vector<int>; const int N=2005; int dsu[N], sz[N]; int find(int x){ if(dsu[x]==-1) return x; return dsu[x]=find(dsu[x]); } void join(int a, int b){ a=find(a); b=find(b); if(a==b) return; dsu[a]=b; sz[b]+=sz[a]; } int min_cardinality(int n) { int ans=n; vi a; fill(dsu,dsu+n,-1); fill(sz,sz+n,1); rep(i,0,n){ move_inside(i); rep(j,i,n){ move_inside(j); if(press_button()==2) join(i,j); move_outside(j); } move_outside(i); } rep(i,0,n) ans=min(ans,sz[find(i)]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...