#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
vector<int> a[MAXN];
int par[MAXN];
int indegree[MAXN];
int outdegree[MAXN];
int n, m, k;
pair<int, int> f[MAXN];
namespace sub2{
bool check(){
for (int i = 1; i <= m; i++){
if (outdegree[f[i].second] == 0){
return false;
}
}
return true;
}
void solve(){
int ans = 0;
for (int i = 1; i <= m; i++){
ans += f[i].second;
}
cout << ans << '\n';
}
}
namespace sub1{
bool check(){
return n <= 20 && k <= 20;
}
void solve(){
for (int i = 1; i <= n; i++){
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
for (int i = 2; i <= n; i++){
int x;
cin >> x;
a[x].push_back(i);
outdegree[x]++;
indegree[x]++;
}
for (int i = 1; i <= m; i++){
cin >> f[i].first >> f[i].first >> f[i].second;
}
if (sub2::check()) sub2::solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
20 ms |
10076 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
31 ms |
11860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
6236 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |