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;
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 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... |