제출 #1173086

#제출 시각아이디문제언어결과실행 시간메모리
1173086lopkusToll (BOI17_toll)C++20
10 / 100
32 ms6216 KiB
#include <bits/stdc++.h>+ signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int k, n, m, Q; std::cin >> k >> n >> m >> Q; std::vector<std::pair<int,int64_t>> adj[n]; for(int i = 1; i <= m; i++) { int64_t u, v, t; std::cin >> u >> v >> t; adj[u].push_back({v, t}); } std::vector<int64_t> dist(n + 1, 1e18); std::priority_queue<std::pair<int,int>> pq; std::vector<int> was(n); pq.push({0, 0}); dist[0] = 0; while(!pq.empty()) { int v = (pq.top()).second; int cost = - (pq.top()).first; pq.pop(); if(was[v]) { continue; } was[v] = 1; for(auto [u, t] : adj[v]) { if(dist[u] > dist[v] + t) { dist[u] = dist[v] + t; pq.push({-dist[u], u}); } } } while(Q--) { int u, v; std::cin >> u >> v; std::cout << (dist[v] == 1e18 ? - 1 : dist[v]) << "\n"; } }

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

toll.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.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...