제출 #868663

#제출 시각아이디문제언어결과실행 시간메모리
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()); }

컴파일 시 표준 에러 (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...