Submission #242257

# Submission time Handle Problem Language Result Execution time Memory
242257 2020-06-27T07:40:09 Z tqbfjotld Magic Tree (CEOI19_magictree) C++14
3 / 100
59 ms 2040 KB
/*
subtask 1 - brute force
subtask 2 - take all
subtask 3 - lds
subtask 4 - dp on tree, day1-day2
*/

#include <bits/stdc++.h>
using namespace std;

int n,m,k;
int p[100005];
int d[100005];
long long w[100005];

int main(){
    scanf("%d%d%d",&n,&m,&k);
    for (int x = 1; x<n; x++){
        scanf("%d",&p[x]);
        p[x]--;
    }
    for (int x = 0; x<m; x++){
        int a,b;
        long long c;
        scanf("%d%d%lld",&a,&b,&c);
        a--;
        d[a] = b;
        w[a] = c;
    }
    long long ans = 0;
    for (int x = 0; x<n; x++){
        ans += w[x];
    }
    printf("%lld",ans);

}

Compilation message

magictree.cpp: In function 'int main()':
magictree.cpp:17: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:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&p[x]);
         ~~~~~^~~~~~~~~~~~
magictree.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%lld",&a,&b,&c);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1912 KB Output is correct
2 Correct 28 ms 896 KB Output is correct
3 Correct 58 ms 1912 KB Output is correct
4 Correct 55 ms 1920 KB Output is correct
5 Correct 59 ms 1760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 2040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -