Submission #884595

#TimeUsernameProblemLanguageResultExecution timeMemory
884595boris_7Magic Tree (CEOI19_magictree)C++17
3 / 100
37 ms10992 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; vector<vector<ll>>gp; void solve(){ ll n,m,k; cin>>n>>m>>k; gp = vector<vector<ll>>(n); for(ll i = 1;i<n;i++){ ll u; cin>>u; --u; // cout<<u<<endl; gp[u].push_back(i); gp[i].push_back(u); } ll ans= 0; vector<pair<ll,ll>>a(n,{0,-1e9}); for(ll i = 0;i<m;i++){ ll u; cin>>u; cin>>a[u].first>>a[u].second; ans+=a[u].second; } cout<<ans<<endl; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); // ll t;cin>>t;while(t--) solve(); }
#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...