Submission #703476

#TimeUsernameProblemLanguageResultExecution timeMemory
703476CyanmondMagic Tree (CEOI19_magictree)C++17
3 / 100
121 ms8168 KiB
#include <bits/stdc++.h> using i64 = long long; int main() { int N, M, K; std::cin >> N >> M >> K; std::vector<int> P(N); std::vector<std::vector<int>> tree(N); for (int i = 1; i < N; ++i) { std::cin >> P[i]; --P[i]; tree[P[i]].push_back(i); } std::vector<int> U(M), D(M); std::vector<i64> W(M); for (int i = 0; i < M; ++i) { std::cin >> U[i] >> D[i] >> W[i]; --U[i]; } std::cout << std::accumulate(W.begin(), W.end(), 0ll) << std::endl; }
#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...