제출 #977191

#제출 시각아이디문제언어결과실행 시간메모리
977191Mardonbekhazratov사이버랜드 (APIO23_cyberland)C++17
8 / 100
1685 ms2097152 KiB
#include "cyberland.h" #include<bits/stdc++.h> #include <vector> #define ll long long using namespace std; int h; vector<int>a; vector<vector<array<int,2>>>v; ll dfs(int x,int p,ll c){ if(x==h) return c; if(a[x]==0) c=0; for(auto [y,z]:v[x]){ if(y!=p){ ll ans=dfs(y,x,c+z); if(ans!=-1) return ans; } } return -1; } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { v.assign(N,vector<array<int,2>>(0)); a.resize(N); for(int i=0;i<N;i++) a[i]=arr[i]; h=H; for(int i=0;i<M;i++){ v[x[i]].push_back({y[i],c[i]}); v[y[i]].push_back({x[i],c[i]}); } double ans=dfs(0,0,0); return ans; }
#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...