제출 #886181

#제출 시각아이디문제언어결과실행 시간메모리
886181vjudge1Airplane (NOI23_airplane)C++11
22 / 100
160 ms12232 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; int main(){ int n, m; cin >> n >> m; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } vector<vector<int>> G(n); for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; --a, --b; G[a].pb(b); G[b].pb(a); } // time, minalt, v priority_queue<array<int, 3>, vector<array<int, 3>>, greater<array<int, 3>>> q; q.push({0, 0, 0}); vector<bool> vis(n); vis[0] = 1; int ans = INT_MAX; while(!q.empty()){ auto [time, minalt, u] = q.top(); q.pop(); // cout << u << ' ' << for(int v : G[u]){ if(vis[v]) continue; if(v == n-1){ ans = min(ans, time + minalt + (minalt == 0)); } else if(time < a[v] - 1){ vis[v] = 1; q.push({a[v], a[v], v}); } else{ vis[v] = 1; q.push({time+1, max(max(minalt-1, a[v]), 0), v}); } } } cout << ans << endl; }

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

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