Submission #970556

#TimeUsernameProblemLanguageResultExecution timeMemory
970556SuPythony사이버랜드 (APIO23_cyberland)C++17
8 / 100
2828 ms2097152 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<vector<pair<int,int>>> al; double ans; double curr; void dfs(int i, int p, int f) { if (i==f) { ans=curr; return; } for (auto v: al[i]) { if (v.first==p) continue; curr+=v.second; dfs(v.first,i,f); curr-=v.second; } } double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> a) { curr=0; al.assign(1e5,vector<pair<int,int>>()); for (int i=0; i<M; i++) { al[x[i]].push_back({y[i],c[i]}); al[y[i]].push_back({x[i],c[i]}); } dfs(0,-1,H); 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...