이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define lln long long
const long long INF = numeric_limits<long long>::max();
using pll = pair<long,long>;
void solve() {
    lln N, E, K; cin >> N >> E >> K;
    vector<lln> cities(N+1), vcities(K); //cities are 0-indexed,, 1 city will be the mega target (coalsced voting cities)
    vector<pll> roads(E);
    map<lln, vector<pll> > adj;
    
    for (lln i=0;i<K;i++) cin >> vcities[i]; //list of voting cities
    for (lln i=0;i<E;i++) {
        lln u, v, c; cin >> u >> v >> c; //we reverse the graph so instead of u->v, v-> u (see notes for subtask 2)
        adj[v].push_back({u,c});
    }
    //connecting mega target (which is city `N`)
    for (auto& vc : vcities) adj[N].push_back({vc,0});
    //dijkstra proper
    vector<lln> d(N+1,INF);
    vector<bool> done(N+1,false);
    lln source = N;
    priority_queue<pll, vector<pll>, greater<pll> > pq;
    pq.push({0, source});  // first parameter of pll is the distance/total weight, second parameter is index
    d[source] = 0;
    while(!pq.empty()) {
        auto& [sofar, city] = pq.top(); pq.pop();
        if (!done[city]) {
            for(auto& [to, cost] : adj[city]) {
                if (d[to]>sofar+cost) {
                    d[to] = sofar + cost;
                    pq.push({d[to], to});
                }
            }
        }
    }
    //Queries stuff
    lln Q; cin >> Q;
    for (lln q=0;q<Q;q++) {
        lln asked; cin >> asked;
        vector<lln> tickets(5);
        for (lln i=0;i<5;i++) cin >> tickets[i];
        if (d[asked]==INF) cout << -1 << '\n';
        else cout << d[asked] << '\n';
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lln t = 1;
    while (t--) solve();
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'void solve()':
Main.cpp:33:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   33 |         auto& [sofar, city] = pq.top(); pq.pop();
      |               ^
Main.cpp:35:23: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 |             for(auto& [to, cost] : adj[city]) {
      |                       ^| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |