Submission #242296

# Submission time Handle Problem Language Result Execution time Memory
242296 2020-06-27T08:25:39 Z dantoh000 Magic Tree (CEOI19_magictree) C++14
0 / 100
75 ms 4728 KB
#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

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 time Memory Grader output
1 Incorrect 6 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 4472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 4728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -