제출 #758954

#제출 시각아이디문제언어결과실행 시간메모리
758954roCatalystVoting Cities (NOI22_votingcity)C++14
20 / 100
14 ms1244 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll inf = 100000000000000; struct edge { int v; int weight; }; int main() { int N, E, K; cin >> N >> E >> K; vector<int> T; for (int i = 0; i < K; i++) { int Ki; cin >> Ki; T.push_back(Ki); } vector<vector<edge>> AL (N); for (int i = 0; i < E; i++) { int U, V, C; cin >> U >> V >> C; AL[V].push_back({U,C}); } map<int,ll> dist; map<int,bool> done; for (int i = 0; i < N; i++) { dist[i] = inf; done[i] = false; } using pli = pair<ll,int>; priority_queue<pli,vector<pli>,greater<pli>> pq; for (auto p = T.begin(); p != T.end(); p++) { pq.push({0,*p}); dist[*p] = 0; } while (!pq.empty()) { auto [_,u] = pq.top(); pq.pop(); if (!done[u]) { for (edge& e: AL[u]) { if (dist[e.v] > dist[u] + e.weight) { dist[e.v] = dist[u] + e.weight; pq.push({dist[e.v],e.v}); } } done[u] = true; } } /* for (int i = 0; i < N; i++) { cout << dist[i] << ' '; } cout << endl;*/ int Q; cin >> Q; for (int i = 0; i < Q; i++) { vector<int> P; int S; cin >> S; for (int i = 0; i < 5; i++) { int Pi; cin >> Pi; P.push_back(Pi); } if (dist[S] == inf) { cout << -1 << endl; } else { cout << dist[S] << endl; } } }

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

Main.cpp: In function 'int main()':
Main.cpp:46:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   46 |         auto [_,u] = pq.top();
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...