Submission #917762

#TimeUsernameProblemLanguageResultExecution timeMemory
917762XXBabaProBerkayCyberland (APIO23_cyberland)C++17
0 / 100
1311 ms2097152 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second using ll = long long; vector<vector<pair<int, int>>> adj; int dfs(int k, int p, int &H) { if (k == H) return 1; for (pair<int, int> i : adj[k]) if (i.F != p) { int x = dfs(i.F, k, H); if (x > 0) return x + i.S; } return 0; } double solve(int N, int M, int H, int K, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { adj.resize(N); for (int i = 0; i < M; i++) { adj[x[i]].emplace_back(y[i], c[i]); adj[y[i]].emplace_back(x[i], c[i]); } return double(dfs(0, 0, H) - 1); }
#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...