Submission #124517

# Submission time Handle Problem Language Result Execution time Memory
124517 2019-07-03T13:14:24 Z streifi Sightseeing (NOI14_sightseeing) C++14
Compilation error
0 ms 0 KB
#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;
	}
}

Compilation message

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])
                    ^