Submission #898725

#TimeUsernameProblemLanguageResultExecution timeMemory
898725vjudge1Magic Tree (CEOI19_magictree)C++17
3 / 100
75 ms4328 KiB
#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 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...