Submission #630402

#TimeUsernameProblemLanguageResultExecution timeMemory
630402NintsiChkhaidzeCrocodile's Underground City (IOI11_crocodile)C++14
46 / 100
129 ms262144 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; #define s second #define pb push_back #define f first const int nn = 100005; vector <pair<int,int> > v[nn]; int dp[nn]; // int R[nn][4],L[nn],P[nn]; void dfs(int x,int par){ int mn1 = 1e9,mn2 = 1e9; for (auto [to,w]: v[x]){ if (to == par) continue; dfs(to,x); int vl = dp[to] + w; if (vl < mn1) mn2 = mn1,mn1 = vl; else if (vl < mn2) mn2 = vl; } if (v[x].size() == 1) dp[x] = 0; else dp[x] = mn2; } /*int main (){ int N,M,K; cin>>N>>M>>K; */ int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ for (int i = 0; i < M; i++){ // cin>>R[i][0]>>R[i][1]>>L[i]; v[R[i][0]].pb({R[i][1],L[i]}); v[R[i][1]].pb({R[i][0],L[i]}); } // for (int i = 0; i < K; i++) // cin>>P[i]; dfs(0,0); return dp[0]; // cout<<dp[0]; }

Compilation message (stderr)

crocodile.cpp: In function 'void dfs(int, int)':
crocodile.cpp:16:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for (auto [to,w]: v[x]){
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...