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 namespace std;
#define ll long long int
const int mxn=1e5+5;
ll n,m,k,par[mxn],ans=0,res[mxn];
int main(){
cin>>n>>m>>k;
for(int i=2;i<=n;i++){
cin>>par[i];
}
for(int i=1;i<=m;i++){
ll v,d,w;
cin>>v>>d>>w;
res[v]=max(res[v],w);
}
for(int i=1;i<=n;i++){
ans+=res[i];
}
cout<<ans<<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... |