# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242257 | tqbfjotld | Magic Tree (CEOI19_magictree) | C++14 | 59 ms | 2040 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
subtask 1 - brute force
subtask 2 - take all
subtask 3 - lds
subtask 4 - dp on tree, day1-day2
*/
#include <bits/stdc++.h>
using namespace std;
int n,m,k;
int p[100005];
int d[100005];
long long w[100005];
int main(){
scanf("%d%d%d",&n,&m,&k);
for (int x = 1; x<n; x++){
scanf("%d",&p[x]);
p[x]--;
}
for (int x = 0; x<m; x++){
int a,b;
long long c;
scanf("%d%d%lld",&a,&b,&c);
a--;
d[a] = b;
w[a] = c;
}
long long ans = 0;
for (int x = 0; x<n; x++){
ans += w[x];
}
printf("%lld",ans);
}
Compilation message (stderr)
# | 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... |