This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/******************************************************
| '_ \ / _` |/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | (__| | | | | | (_| | | | |
| .__/ \__,_|\___|_| |_| |_|\__,_|_| |_|
|_|
__| |____________________________________________
,--. ,--. ,--. ,--.
|oo | _ \ `. | oo | | oo|
o o|~~ |(_) / ; | ~~ | | ~~|o o o o o
|/\/\| '._,' |/\/\| |/\/\|
__________________ ____________________________
******************************************************/
#include <bits/stdc++.h>
//#include "bigint.h"
#define db(x) cerr << #x << ": " << x << endl
#define print cerr << "Ah shit, here we go agian" << endl
#define int long long int
#define vii vector<int>
#define pii pair<int ,int>
#define vpi vector< pii >
#define ff first
#define ss second
#define mp make_pair
#define mod 1000000007
using namespace std;
const int maxn = 1e5 + 100;
int n, m, k;
vector<int> adj[maxn], child[maxn];
int w[maxn], d[maxn];
map<int ,int> dp[maxn];
void solve(){
cin >> n >> m >> k;
//int dp[n + 10][k + 10] = {};
for(int i = 2 ;i <= n; i++){
int x;
cin >> x;
adj[x].push_back(i);
adj[i].push_back(x);
}
int ans = 0;
for(int i = 1 ;i <= m; i++){
int v;
cin >> v;
cin >> d[v] >> w[v];
ans += w[v];
}
cout << ans << endl;
}
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0) ,cout.tie(0);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int t = 1;
/// cin >> t;
while(t--){
solve();
}
return 0;
}
# | 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... |