#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 |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
5884 KB |
Output is correct |
2 |
Correct |
52 ms |
6800 KB |
Output is correct |
3 |
Correct |
106 ms |
7560 KB |
Output is correct |
4 |
Correct |
89 ms |
6948 KB |
Output is correct |
5 |
Correct |
121 ms |
7576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
104 ms |
8168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
1236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |