제출 #752958

#제출 시각아이디문제언어결과실행 시간메모리
752958MohamedFaresNebili사이버랜드 (APIO23_cyberland)C++17
0 / 100
151 ms6664 KiB
#include <bits/stdc++.h> using namespace std; int N, M, K, H, A[100005]; double D1[100005], D2[100005], D3[100005]; vector<pair<int, int>> adj[100005]; double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { for(int l = 0; l < n; l++) D1[l] = 1000000007; D1[0] = 0; for(int l = 0; l < m; l++) { adj[x[l]].push_back({y[l], c[l]}); adj[y[l]].push_back({x[l], c[l]}); } priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; pq.push({0, 0}); while(!pq.empty()) { double W = pq.top().first; int U = pq.top().second; pq.pop(); if(U == h) continue; for(auto V : adj[U]) { if(D1[V.first] > W + V.second) { D1[V.first] = W + V.second; if(arr[V.first] == 0) D1[V.first] = 0; pq.push({D1[V.first], V.first}); } } } if(D1[h] == 1000000007) return -1; return D1[h]; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...