Submission #720849

#TimeUsernameProblemLanguageResultExecution timeMemory
720849MakarooniToll (BOI17_toll)C++17
Compilation error
0 ms0 KiB
/* IN THE NAME OF GOD */ /* |\/| /-\ |\| | |\/| /-\ */ #include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #define sz(x) (int)x.size() #define endl '\n' #define pb push_back #define F first #define S second #define mr make_pair #define pii pair<int, int> const int N = 5e4 + 1; int inf = 5e8 + 1; vector<pii> g[N]; int dis[N], qq[2][10001], ans[10001], mx[N], qqq[10001]; int Q[N][10001]; int pt[N]; int bl[N]; int main(){ ios_base:: sync_with_stdio(0), cin.tie(0), cout.tie(0); int k, n, m, q; cin >> k >> n >> m >> q; int u, v, w; for(int i = 1; i <= m; i++){ cin >> u >> v >> w; g[u].pb(mr(v, w)); } int p = 0; for(int i = 1; i <= q; i++){ cin >> qq[0][i] >> qq[1][i]; if(qq[0][i] > qq[1][i]){ ans[i] = -1; continue; } if(qq[0][i] == qq[1][i]) continue; if(qq[0][i] / k == qq[1][i] / k){ ans[i] = -1; continue; } Q[qq[0][i]][pt[qq[0][i]]] = i; pt[qq[0][i]]++; mx[qq[0][i]] = max(mx[qq[0][i]], qq[1][i]); if(!bl[qq[0][i]]){ qqq[p] = qq[0][i]; p++; } bl[qq[0][i]] = 1; } for(int i = 0; i < p; i++){ memset(dis, 31, sizeof dis); u = qqq[i]; dis[u] = 0; bl[u] = 1; for(int j = u; j < mx[u]; j++){ for(pii l : g[j]){ dis[l.F] = min(dis[l.F], l.S + dis[j]); } } for(int j = 0; j < pt[u]; j++){ w = Q[u][j]; v = qq[1][w]; if(dis[v] >= inf) ans[w] = -1;A else ans[w] = dis[v]; } } for(int i = 1; i <= q; i++){ cout << ans[i] << endl; } }

Compilation message (stderr)

toll.cpp: In function 'int main()':
toll.cpp:69:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   69 |    if(dis[v] >= inf)
      |    ^~
toll.cpp:70:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   70 |     ans[w] = -1;A
      |                 ^
toll.cpp:70:17: error: 'A' was not declared in this scope