Submission #884590

#TimeUsernameProblemLanguageResultExecution timeMemory
884590boris_7Magic Tree (CEOI19_magictree)C++17
0 / 100
35 ms8716 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; vector<vector<int>>gp; void solve(){ int n,m,k; cin>>n>>m>>k; gp = vector<vector<int>>(n); for(int i = 1;i<n;i++){ int u; cin>>u; --u; // cout<<u<<endl; gp[u].push_back(i); gp[i].push_back(u); } int ans= 0; vector<pair<int,int>>a(n,{0,-1e9}); for(int i = 0;i<m;i++){ int 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); // int 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...