제출 #1102708

#제출 시각아이디문제언어결과실행 시간메모리
1102708huantranSjekira (COCI20_sjekira)C++17
110 / 110
20 ms3332 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; typedef long long int ll; int n; ll t[maxn]; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); ll sum = 0; ll mx = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> t[i]; sum += t[i]; mx = max(mx, t[i]); } for (int i = 1; i <= n - 1; i++) { int a, b; cin >> a >> b; sum += max(t[a], t[b]); } cout << sum - mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...