Submission #1107600

# Submission time Handle Problem Language Result Execution time Memory
1107600 2024-11-01T16:36:56 Z vjudge1 Magic Tree (CEOI19_magictree) C++17
3 / 100
36 ms 18000 KB
/******************************************************
| '_ \ / _` |/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | (__| | | | | | (_| | | | |
| .__/ \__,_|\___|_| |_| |_|\__,_|_| |_|
|_|

__|      |____________________________________________
     ,--.    ,--.          ,--.   ,--.
    |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
1 Incorrect 3 ms 11344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 16244 KB Output is correct
2 Correct 21 ms 15612 KB Output is correct
3 Correct 36 ms 18000 KB Output is correct
4 Correct 28 ms 17448 KB Output is correct
5 Correct 32 ms 17992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 11344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 17232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 11344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 12212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 11344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 11344 KB Output isn't correct
2 Halted 0 ms 0 KB -