제출 #963595

#제출 시각아이디문제언어결과실행 시간메모리
963595Trisanu_DasGarden (JOI23_garden)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define vt vector #define size(x) (int((x).size())) #define all(x) begin(x), end(x) #define REP(a,b,c,d) for(int a=(b);(d)>0?a<=(c):a>=(c);a+=(d)) #define FOR(a,b,c) REP(a,b,c,1) #define ROF(a,b,c) REP(a,b,c,-1) struct DSU { vector<int> uf; DSU(int n):uf(vector<int>(n,-1)){} int find(int i){ return uf[i]<0?i:uf[i]=find(uf[i]); } bool unite(int a,int b){ if((a=find(a))==(b=find(b))) return false; if(uf[a]>uf[b]) swap(a,b); uf[a]+=uf[b]; uf[b]=a; return false; } int sz(int i){ return -uf[find(i)]; } }; signed main() { #ifndef DEBUG ios_base::sync_with_stdio(false); cin.tie(nullptr); #endif int N,M,D; cin>>N>>M>>D; vector<bool> x_need(D),y_need(D); for(int i = 0; i < N; i++){ int x,y; cin>>x>>y; x_need[x]=y_need[y]=true; } vector<int> R(D,-1); vector<vector<int>> change(D); while(M--){ int x,y; cin>>x>>y; if(!y_need[y]){ R[y]=max(R[y],x); change[x].push_back(y); } } int ans=D*D; for(int l = 0; l < D; l++){ vector<vector<int>> can_kill(D); vector<bool> deleted(D); DSU uf(D); int gap=0; auto insert=[&](int i){ deleted[i]=true; for(int k:{-1,1}){ int j=(i+k+D)%D; if(deleted[j]) uf.unite(i,j); } gap=max(gap,uf.sz(i)); }; for(int i = 0; i < D; i++){ if (R[i]>=0) can_kill[R[i]].push_back(i); else if(!y_need[i]) insert(i); } int need=accumulate(all(x_need),0); for(int d = 1; d <= D; d++){ int r=(l+d-1)%D; need-=x_need[r]; for(int i:can_kill[r]) insert(i); if(!need) ans=min(ans,d*(D-gap)); } for(int i:change[l]) R[i]=l; cout<<ans<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

garden.cpp: In function 'int main()':
garden.cpp:82:1: error: expected '}' at end of input
   82 | }
      | ^
garden.cpp:32:15: note: to match this '{'
   32 | signed main() {
      |               ^