Submission #242296

#TimeUsernameProblemLanguageResultExecution timeMemory
242296dantoh000Magic Tree (CEOI19_magictree)C++14
0 / 100
75 ms4728 KiB
#include <bits/stdc++.h> using namespace std; int n,m,k; int p[100005]; vector<int> G[100005]; long long ans; int dp1[100005], dp2[100005]; int main(){ scanf("%d%d%d",&n,&m,&k); for (int i = 2; i <= n; i++){ scanf("%d",&p[i]); G[p[i]].push_back(i); } int ans = 0; for (int i = 0; i < m; i++){ int v,d,w; scanf("%d%d%d",&v,&d,&w); ans += w; } printf("%lld",ans); //dfs(1,-1); //printf("%d",dp1[]; }

Compilation message (stderr)

magictree.cpp: In function 'int main()':
magictree.cpp:20:22: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
     printf("%lld",ans);
                      ^
magictree.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&n,&m,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~
magictree.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&p[i]);
         ~~~~~^~~~~~~~~~~~
magictree.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&v,&d,&w);
         ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...