제출 #81082

#제출 시각아이디문제언어결과실행 시간메모리
81082ToadDaveskiEvacuation plan (IZhO18_plan)C++14
0 / 100
377 ms14272 KiB
#include <bits/stdc++.h> #define ll long long #define fr first #define sc second using namespace std; vector <pair <ll,ll> > v[100001]; ll dp[100001]; priority_queue <pair <ll,ll> > q; int main() { ll n,m,Q,k,i,j; cin>>n>>m; for(i=1;i<=n;i++) dp[i]=1e9; for(i=1;i<=m;i++) { ll x,y,z; cin>>x>>y>>z; v[x].push_back({y,z}); v[y].push_back({x,z}); } cin>>k; for(i=1;i<=k;i++) { ll x,y; cin>>x; q.push({x,0}); } while(!q.empty()) { ll from=q.top().sc; ll weight=-q.top().fr; q.pop(); if (dp[from]<weight) continue; for(auto to : v[from]) { if (dp[to.fr]>dp[from]+to.sc) { dp[to.fr]=dp[from]+to.sc; q.push({-(dp[from]+to.sc),to.fr}); } } } cin>>Q; for(i=1;i<=Q;i++) { ll x,y; cin>>x>>y; cout<<min(dp[x],dp[y])<<endl; } return 0; }

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

plan.cpp: In function 'int main()':
plan.cpp:25:14: warning: unused variable 'y' [-Wunused-variable]
         ll x,y;
              ^
plan.cpp:11:18: warning: unused variable 'j' [-Wunused-variable]
     ll n,m,Q,k,i,j;
                  ^
#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...