제출 #1008979

#제출 시각아이디문제언어결과실행 시간메모리
1008979makanhuliaCommuter Pass (JOI18_commuter_pass)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' #define hitaf ios_base::sync_with_stdio(false); cin.tie(NULL); #define fi first #define se second const ll MOD = 998244353; const ll INF = 1e18; ll n, m, s, t, u, V; vector<pair<ll, ll>> adj[100005]; bool vis[100005]; int main(){ //hitaf cin >> n >> m; cin >> s >> t; cin >> u >> V; vector<ll> dist(n + 2, INF), dist2(n + 2, INF); for(int i = 1; i <= m; i++){ ll x, y, w; cin >> x >> y >> w; adj[x].push_back({y, w}); adj[y].push_back({x,w}); } priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq; pq.push({0, s}); dist[s] = 0; while(!pq.empty()){ auto now = pq.top(); pq.pop(); if(dist[now.se] < now.fi) continue; for(auto v: adj[now.se]){ if(dist[v.fi] < now.fi + v.se) continue; dist[v.fi] = now.fi + v.se; pq.push({dist[v.fi], v.fi}); } } set<pair<ll, ll>> st; queue<ll> q; q.push(t); while(!q.empty()){ ll u = q.top(); q.pop(); if(vis[u]) continue; for(auto v: adj[u]){ if(dist[v.fi] + v.se == dist[u]){ st.insert({v.fi, u}); vis[v.fi] = true; q.push(v.fi); } } } priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq2; pq2.push({0, u}); while(!pq2.empty()){ auto now = pq2.top(); pq2.pop(); if(dist2[now.se] < now.fi) continue; for(auto v: adj[now.se]){ ll w = v.se; if(st.find({v.fi, now.se}) != st.end()) w = 0; if(dist2[v.fi] < now.fi + w) continue; dist2[v.fi] = now.fi + w; pq2.push({dist2[v.fi], v.fi}); } } cout << dist2[V] << endl; } /* 7 1 2 9 0 */

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

commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:50:18: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   50 |         ll u = q.top();
      |                  ^~~
      |                  pop