제출 #977180

#제출 시각아이디문제언어결과실행 시간메모리
977180Mardonbekhazratov사이버랜드 (APIO23_cyberland)C++17
0 / 100
18 ms5320 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, std::vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { swap(a,arr); 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...