https://www.acmicpc.net/problem/1504 1504번: 특정한 최단 경로 첫째 줄에 정점의 개수 N과 간선의 개수 E가 주어진다. (2 ≤ N ≤ 800, 0 ≤ E ≤ 200,000) 둘째 줄부터 E개의 줄에 걸쳐서 세 개의 정수 a, b, c가 주어지는데, a번 정점에서 b번 정점까지 양방향 길이 존 www.acmicpc.net #include #include #include #include using namespace std; int N, E, V1, V2, Cnt; map m; vector Dist, SaveDist; void Dijkstra(int start) { priority_queue pq; pq.push({ 0, start }); Dist[start] = 0; wh..
다익스트라
https://www.acmicpc.net/problem/1238 1238번: 파티 첫째 줄에 N(1 ≤ N ≤ 1,000), M(1 ≤ M ≤ 10,000), X가 공백으로 구분되어 입력된다. 두 번째 줄부터 M+1번째 줄까지 i번째 도로의 시작점, 끝점, 그리고 이 도로를 지나는데 필요한 소요시간 Ti가 들어 www.acmicpc.net #include #include #include #include using namespace std; int N, M, X, Cnt; map m; vector D1, D2; int Dijkstra(int start, int dest) { priority_queue pq; vector visit(N + 1, false); vector dist(N + 1, 9876543..