Submission #1126257

#TimeUsernameProblemLanguageResultExecution timeMemory
1126257psm9352Cyberland (APIO23_cyberland)C++20
8 / 100
1598 ms2162688 KiB
#include <vector> #include <queue> using namespace std; void dfs(int par,int node, vector<vector<pair<int,double>>> &graph,vector<double> &ans){ for (pair<int,double> next:graph[node]){ if (next.first==par){continue;} ans[next.first]=ans[node]+next.second; dfs(node,next.first,graph,ans); } } double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){ vector<vector<pair<int,double>>> graph(N); for (int i = 0;i<M;i++){ graph[x[i]].push_back({y[i],c[i]}); graph[y[i]].push_back({x[i],c[i]}); } vector<double> ans(N,1e18);ans[0]=0; vector<bool> visited(N,0); dfs(-1,0,graph,ans); if (ans[H]>=1e18){return -1;} return ans[H]; }
#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...