제출 #884444

#제출 시각아이디문제언어결과실행 시간메모리
884444DAleksaCommuter Pass (JOI18_commuter_pass)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; struct node { int v; int w; }; const int N = 1e5 + 10; int n, m; int S, T, U, V; vector<node> g[N]; vector<long long> distS(N), distT(N), distU(N), distV(N); int fst[N]; long long dp[N]; void dijkstra(int start, vector<long long>& dist) { for(int i = 1; i <= n; i++) dist[i] = 1e18; dist[start] = 0; set<pair<long long, int>> s; s.insert({0, start}); while(!s.empty()) { pair<long long, int> p = *s.begin(); s.erase(s.begin()); long long d = p.first; int u = p.second; for(node v : g[u]) { if(dist[u] + v.w < dist[v.v]) { dist[v.v] = dist[u] + v.w; s.insert({dist[v.v], v.v}); } } } } void find_dp(int u) { if(dp[u] != -1) return; dp[u] = 1e18; if(distS[u] + distT[u] != distS[T]) return; for(int v : g[u]) { if() } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m >> S >> T >> U >> V; for(int i = 0; i < m; i++) { int u, v, w; cin >> u >> v >> w; g[u].push_back({v, w}); g[v].push_back({u, w}); } dijkstra(S, distS); dijkstra(T, distT); dijkstra(U, distU); dijkstra(V, distV); for(int i = 1; i <= n; i++) { fst[i] = i; dp[i] = -1; } long long ans = 1e18; for(int i = 1; i <= n; i++) { if(dp[i] == -1) find_dp(i); ans = min(ans, dp[i]); } // for(int i = 1; i <= n; i++) cout << dp[i] << " "; // cout << "\n"; cout << ans; return 0; }

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

commuter_pass.cpp: In function 'void dijkstra(int, std::vector<long long int>&)':
commuter_pass.cpp:26:19: warning: unused variable 'd' [-Wunused-variable]
   26 |         long long d = p.first;
      |                   ^
commuter_pass.cpp: In function 'void find_dp(int)':
commuter_pass.cpp:41:20: error: cannot convert 'node' to 'int' in initialization
   41 |     for(int v : g[u]) {
      |                    ^
commuter_pass.cpp:42:12: error: expected primary-expression before ')' token
   42 |         if()
      |            ^
commuter_pass.cpp:43:5: error: expected primary-expression before '}' token
   43 |     }
      |     ^
commuter_pass.cpp:41:13: warning: unused variable 'v' [-Wunused-variable]
   41 |     for(int v : g[u]) {
      |             ^