제출 #1099665

#제출 시각아이디문제언어결과실행 시간메모리
1099665Saul0906도로 폐쇄 (APIO21_roads)C++14
0 / 100
200 ms219924 KiB
#include "roads.h" #include <bits/stdc++.h> #define rep(a,b,c) for(int a=b; a<c; a++) #define repr(a,b,c) for(int a=b-1; a>c-1; a--) #define rep2(a,b,c,d) for(int a=b; a<c; a+=d) #define repa(a,b) for(auto a:b) #define fi first #define se second #define pb push_back #define pq_min(a) priority_queue<a, vector<a>, greater<a>> using namespace std; using ll = long long int; using vi = vector<int>; using vll = vector<ll>; using pii = pair<int, int>; using pll = pair<ll, ll>; const int lim=2005; const ll inf=1e18; ll dp[lim][lim][2], n; pq_min(ll) pq[lim][lim]; vector<pii> adj[lim]; void solve(int u, int p){ dp[u][0][1]=inf; repa(v,adj[u]){ if(v.fi==p) continue; solve(v.fi,u); repr(i,n,0){ pq[u][i].push(dp[v.fi][i][0]+v.se-dp[v.fi][i][1]); dp[u][i][0]+=dp[v.fi][i][1]; dp[u][i][1]+=dp[v.fi][i][1]; } } rep(i,0,n){ while(pq[u][i].size()>i){ dp[u][i][0]+=pq[u][i].top(); dp[u][i][1]+=pq[u][i].top(); pq[u][i].pop(); } if(pq[u][i].size() && pq[u][i].size()==i) dp[u][i][1]+=pq[u][i].top(); if(!i) dp[u][i][1]=inf; while(pq[u][i].size()) pq[u][i].pop(); } } vll minimum_closure_costs(int N, vi U, vi V, vi W) { if(N>=lim) return vll(N, 0); n=N; rep(i,0,n-1) adj[U[i]].pb({V[i],W[i]}), adj[V[i]].pb({U[i],W[i]}); solve(0,-1); vll ans; rep(i,0,n) ans.pb(dp[0][i][0]); return ans; }

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

roads.cpp: In function 'void solve(int, int)':
roads.cpp:38:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |   while(pq[u][i].size()>i){
      |         ~~~~~~~~~~~~~~~^~
roads.cpp:43:40: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |   if(pq[u][i].size() && pq[u][i].size()==i) dp[u][i][1]+=pq[u][i].top();
      |                         ~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...