# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242270 | cheeheng | Magic Tree (CEOI19_magictree) | C++14 | 81 ms | 5376 KiB |
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;
vector<int> AdjList[100005];
int d[100005];
int w[100005];
int main(){
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for(int i = 2; i <= n; i ++){
int p;
scanf("%d", &p);
AdjList[p].push_back(i);
}
bool subtask2 = true;
long long ans2 = 0;
for(int i = 1; i <= m; i ++){
int x, y, z;
scanf("%d%d%d", &x, &y, &z);
subtask2 &= AdjList[x].empty();
d[x] = y;
w[x] = z;
ans2 += w[x];
}
if(subtask2){
printf("%lld", ans2);
return 0;
}
return 0;
}
Compilation message (stderr)
# | 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... |