제출 #628776

#제출 시각아이디문제언어결과실행 시간메모리
628776a_aguiloToll (BOI17_toll)C++14
0 / 100
110 ms3316 KiB
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vpii; typedef vector<vpii> v2pii; int main(){ int K, N, M, O, a, b, t; cin >> K >> N >> M >> O; v2pii listaAdy(N); for(int i = 0; i < M; ++i){ cin >> a >> b >> t; listaAdy[a].push_back({b, t}); } vi dist(N, 1e9+7); dist[0] = 0; pii inicio = {-0, 0}; priority_queue<pii> PQ; PQ.push(inicio); while(!PQ.empty()){ pii act = PQ.top(); PQ.pop(); int distAct = -1*act.first; int nodo = act.second; if(distAct > dist[nodo]) continue; dist[nodo] = distAct; for(pii vecino: listaAdy[nodo]){ PQ.push({-1*(distAct+vecino.second), vecino.first}); } } while(O--){ cin >> a >> b; cout << dist[b] << endl; } return 0; }
#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...