Submission #917741

#TimeUsernameProblemLanguageResultExecution timeMemory
917741406Robot (JOI21_ho_t4)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int int64_t #define FOR(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ar = array<int, 2>; using ar3 = array<int, 3>; const int64_t INF = 1ll << 60; const int N = 2e5 + 5; vector<ar3> adj[N]; int n, m, C[N], d[N], cnt[N], sum[N]; ar last[N]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; FOR(i, 0, m) { int u, v, c, p; cin >> u >> v >> c >> p; --u, --v; adj[v].push_back({u, c, p}); adj[u].push_back({v, c, p}); } fill(last, last + N, ar{-1, -1}); vector<array<int, 4>> E; FOR(i, 0, n) { for (auto [u, c, p]: adj[i]) cnt[c]++, sum[c] += p; for (auto &[u, c, p]: adj[i]) { p = min(p, sum[c] - p); if (cnt[c] == 2) { if (last[c][0] == -1) last[c] = {u, p}; else { E.push_back({last[c][0], u, c, last[c][1]}); E.push_back({u, last[c][0], c, p}); } } } for (auto [u, c, p]: adj[i]) cnt[c] = sum[c] = 0, last[c][0] = -1; } for (auto [u, v, c, p]: E) adj[u].push_back({v, c, p}); fill(d + 1, d + N, INF); queue<int> q; q.push(0); while (q.size()) { int v = q.front(); q.pop(); for (auto [u, c, p]: adj[v]) { int w = d[v] + p; if (w < d[u]) { q.push(u); d[u] = w; } } } cout << (d[n - 1] < INF ? d[n - 1] : -1) << '\n'; return 0;

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:62:17: error: expected '}' at end of input
   62 |         return 0;
      |                 ^
Main.cpp:16:15: note: to match this '{'
   16 | signed main() {
      |               ^