제출 #124517

#제출 시각아이디문제언어결과실행 시간메모리
124517streifi관광 (NOI14_sightseeing)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; struct edge { int v, w; bool operator<(const edge &other) const { return w < other.w; } }; int V, E, Q; vector< vector<edge> > adj; vector<int> dist; void dijkstra(int start) { priority_queue<edge> pq; dist.assign(V, 0); dist[start] = INF; pq.push({start, INF}); while (pq.size()) { edge cur = pq.top(); pq.pop(); if (cur.w < dist[e.v]) continue; for (edge e: adj[cur.v]) { int newdist = min(cur.w, e.w); if (newdist > dist[e.v]) { dist[e.v] = newdist; pq.push({e.v, newdist}); } } } } signed main() { cin >> V >> E >> Q; adj.resize(V); for (int e = 0; e < E; ++e) { int u, v, q; cin >> u >> v >> q; adj[u-1].push_back({v-1, q}); adj[v-1].push_back({u-1, q}); } dijkstra(0); for (int q = 0; q < Q; ++q) { int X; cin >> X; cout << dist[X-1] << endl; } }

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

sightseeing.cpp: In function 'void dijkstra(int)':
sightseeing.cpp:26:20: error: 'e' was not declared in this scope
   if (cur.w < dist[e.v])
                    ^