Submission #868663

#TimeUsernameProblemLanguageResultExecution timeMemory
868663SmuggingSpunSjekira (COCI20_sjekira)C++14
110 / 110
19 ms3132 KiB
#include<bits/stdc++.h> #define taskname "paradigm" using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } int n; cin >> n; ll ans = 0; vector<int>a(n); for(int& x : a) cin >> x, ans += x; for(int i = 1; i < n; i++){ int u, v; cin >> u >> v; ans += max(a[u - 1], a[v - 1]); } cout << ans - *max_element(a.begin(), a.end()); }

Compilation message (stderr)

sjekira.cpp: In function 'int main()':
sjekira.cpp:8:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   freopen(taskname".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sjekira.cpp:9:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   freopen(taskname".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...