제출 #565751

#제출 시각아이디문제언어결과실행 시간메모리
565751AbdullahMWEvacuation plan (IZhO18_plan)C++14
0 / 100
1326 ms524288 KiB
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define ll long long #define db double #define pb push_back #define pf push_front #define newl "\n" #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define f first #define s second #define MOD 1000000007 using namespace std; vector <pair <ll, ll>> gr[100005]; unordered_map <ll, bool> nuc; ll dj(ll beg) { priority_queue <pair <ll, ll>, vector <pair <ll, ll>>, greater <pair <ll, ll>>> pq; unordered_map <ll, ll> vis; pq.push({0, beg}); while (pq.size()) { ll c = pq.top().s, len = pq.top().f; pq.pop(); if (!vis[c]) { if (nuc[c]) return len; for (auto v : gr[c]) { pq.push({len + v.f, v.s}); } } } } int main() { fast //setIO(""); //freopen("filename.in", "r", stdin); //freopen("filename.out", "w", stdout); ll n, m; cin >> n >> m; for (ll i = 1; i <= m; i++) { ll x, y, len; cin >> x >> y >> len; gr[x].pb({len, y}); gr[y].pb({len, x}); } ll k; cin >> k; for (ll i = 1; i <= k; i++) { ll idx; cin >> idx; nuc[idx] = true; } //cout << newl; ll q; cin >> q; while (q--) { ll x, y; cin >> x >> y; ll one = dj(x); if (nuc[x]) one = 0; ll two = dj(y); if (nuc[y]) two = 0; cout << min(one, two) << newl; } /*cout << newl; for (ll i = 1; i <= n; i++) { if (!nuc[i]) cout << "City: " << i << " Dist: " << fin[i] << newl; }*/ }

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

plan.cpp: In function 'long long int dj(long long int)':
plan.cpp:21:85: warning: control reaches end of non-void function [-Wreturn-type]
   21 |     priority_queue <pair <ll, ll>, vector <pair <ll, ll>>, greater <pair <ll, ll>>> pq;
      |                                                                                     ^~
#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...