This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |