답안 #582544

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582544 2022-06-24T04:54:18 Z 반딧불(#8370) Magic Tree (CEOI19_magictree) C++17
3 / 100
65 ms 10940 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m, k;
int par[100002];
vector<int> child[100002];
int in[100002], out[100002], inCnt;
vector<pair<int, ll> > fruit[100002];

int main(){
    scanf("%d %d %d", &n, &m, &k);
    for(int i=2; i<=n; i++) scanf("%d", &par[i]), child[par[i]].push_back(i);
    ll ans = 0;
    for(int i=1; i<=m; i++){
        int v, d, w;
        scanf("%d %d %d", &v, &d, &w);
        fruit[d].push_back(make_pair(v, w));
        ans += w;
    }
    printf("%lld\n", ans);
}

Compilation message

magictree.cpp: In function 'int main()':
magictree.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
magictree.cpp:15:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for(int i=2; i<=n; i++) scanf("%d", &par[i]), child[par[i]].push_back(i);
      |                             ~~~~~^~~~~~~~~~~~~~~
magictree.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d %d %d", &v, &d, &w);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 7556 KB Output is correct
2 Correct 30 ms 9440 KB Output is correct
3 Correct 60 ms 10940 KB Output is correct
4 Correct 50 ms 10296 KB Output is correct
5 Correct 65 ms 10828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 8592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 5332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -