Submission #927151

#TimeUsernameProblemLanguageResultExecution timeMemory
927151Amirreza_FakhriJakarta Skyscrapers (APIO15_skyscraper)C++17
Compilation error
0 ms0 KiB
// In the name of the God #include <bits/stdc++.h> #define ll long long // #define int long long #define pb push_back #define F first #define S second #define mp make_pair #define pii pair <int, int> #define smin(x, y) (x) = min((x), (y)) #define smax(x, y) (x) = max((x), (y)) #define all(x) (x).begin(), (x).end() using namespace std; const int inf = 1e9+7; const int mod = 998244353; const int maxn = 3e4+5; int n, m, s, t, dist[maxn]; set <int> doge[maxn]; priority_queue<pii, vector<pii>, greater<pii> > pq; void dij(int v) { fill(dist, dist+n, inf); dist[v] = 0; pq.push(mp(0, v)); while (pq.size()) { int d = pq.top().F, u = pq.top().S; pq.pop(); if (dist[u] != d) continue; dist[u] = d; if (u == t) return cout << d << '\n', void(); for (int p : doge[u]) { for (int j = 1; u+j*p < n; j++) { st.insert(mp(d+j, u+j*p)); if (doge[u+j*p].find(p) != doge[u+j*p].end()) break; } for (int j = 1; u-j*p >= 0; j++) { st.insert(mp(d+j, u-j*p)); if (doge[u-j*p].find(p) != doge[u-j*p].end()) break; } } } cout << -1 << '\n'; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; doge[a].insert(b); if (i == 0) s = a; if (i == 1) t = a; } dij(s); return 0; }

Compilation message (stderr)

skyscraper.cpp: In function 'void dij(int)':
skyscraper.cpp:35:17: error: 'st' was not declared in this scope; did you mean 't'?
   35 |                 st.insert(mp(d+j, u+j*p));
      |                 ^~
      |                 t
skyscraper.cpp:39:17: error: 'st' was not declared in this scope; did you mean 't'?
   39 |                 st.insert(mp(d+j, u-j*p));
      |                 ^~
      |                 t