답안 #559867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
559867 2022-05-10T19:16:27 Z NintsiChkhaidze Sjekira (COCI20_sjekira) C++14
0 / 110
20 ms 2264 KB
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define s second
#define f first
#define left (h<<1),l,(l+r)>>1
#define right ((h<<1)|1),((l+r)>>1) + 1,r
using namespace std;

const int N = 2000003;
int a[N],n,ans,mx;
signed main (){
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    cin>>n;
    
    for (int i = 1; i <= n; i++){
        cin>>a[i];
        ans += a[i];
        if (a[i] > mx) mx = a[i];
    }
    ans-=mx;
    for (int i = 1; i < n; i++){
        int x,y;
        cin>>x>>y;
        ans+=max(a[x],a[y]);
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 2264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -