제출 #1012324

#제출 시각아이디문제언어결과실행 시간메모리
1012324codefoxRobot (JOI21_ho_t4)C++14
34 / 100
1070 ms125352 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define int long long #define arr array<int, 3> #define pii pair<int, int> #define dbg(...) 0 vector<vector<arr>> graph; int lim = 1e18; int32_t main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; graph.assign(n, vector<arr>()); vector<map<int, int>> cost(n); vector<map<int, int>> dist(n); vector<map<int, vector<pii>>> colour(n); for (int j = 0; j < m; j++) { int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--; graph[a].push_back({b, c, d}); graph[b].push_back({a, c, d}); cost[a][c] +=d; cost[b][c] += d; dist[a][c] = lim; dist[b][c] = lim; colour[a][c].push_back({b, d}); colour[b][c].push_back({a, d}); } for (int i = 0; i < n; i++) dist[i][0] = lim; priority_queue<arr, vector<arr>, greater<arr>> pq; pq.push({0, 0, 0,}); while (pq.size()) { arr a = pq.top(); pq.pop(); int d = a[0]; int c = a[2]; int i = a[1]; if (dist[i][c]<=d) continue; dist[i][c] = d; if (c==0) { for (arr ele:graph[i]) { pq.push({d+cost[i][ele[1]]-ele[2], ele[0], 0}); pq.push({d, ele[0], ele[1]}); pq.push({d+ele[2], ele[0], 0}); } } else { for (pii ele:colour[i][c]) { pq.push({d+cost[i][c]-ele.second, ele.first, 0}); } } } dbg(dist[n-1]); if (dist[n-1][0]>=lim) cout << -1; else cout << dist[n-1][0]; return 0; }

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

Main.cpp: In function 'int32_t main()':
Main.cpp:10:19: warning: statement has no effect [-Wunused-value]
   10 |  #define dbg(...) 0
      |                   ^
Main.cpp:81:1: note: in expansion of macro 'dbg'
   81 | dbg(dist[n-1]);
      | ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...