제출 #922095

#제출 시각아이디문제언어결과실행 시간메모리
922095Nurislam경주 (Race) (IOI11_race)C++14
0 / 100
1 ms2396 KiB
#include "race.h" //~ #include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define pb push_back typedef vector<int> vi; typedef vector<double> vd; typedef pair<int,int> pii; typedef vector<pii> vii; typedef vector<vi> vv; const int inf = 1e9, mod = 998244353; struct gg{ int ps, dp = 0, sm = 0, pr; }; int best_path(int n, int k, int h[][2], int l[]) { vii g[n+1]; for(int i = 0; i < n-1; i++){ g[h[i][0]].pb({h[i][1], l[i]}); g[h[i][1]].pb({h[i][0], l[i]}); } int ans = inf; for(int i = 1; i <= n; i++){ queue<gg> q; gg o; o.ps = i; o.dp = 0; o.sm = 0; o.pr = -1; while(!q.empty()){ gg res = q.front(); q.pop(); if(res.sm > k)continue; if(res.sm == k){ ans = min(ans, o.dp); continue; } for(auto [to, cst]:g[res.ps]){ if(to == res.pr)continue; gg nw; nw.ps = to; nw.pr = res.ps; nw.sm = res.sm+cst; nw.dp = res.dp+1; q.push(nw); } } } return ans; }

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

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:45:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   45 |    for(auto [to, cst]:g[res.ps]){
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...