제출 #328129

#제출 시각아이디문제언어결과실행 시간메모리
328129hhhhauraSjekira (COCI20_sjekira)C++14
110 / 110
32 ms3304 KiB
#include <bits/stdc++.h> #pragma loop-opt(on) #pragma GCC optmize("Ofast") #define print(x) cout << #x <<" = " << x << endl #define pprint(x) cout << #x <<" = (" << x.first << " , " << x.second <<" )\n" #define rep(i, a, b) for(int i = a; i <= b; i++) #define rrep(i, a, b) for(int i = b; i >= a; i--) #define ceil(a, b) ((a + b - 1) / b) #define all(x) x.begin(), x.end() #define MAXN 1000005 #define INF 1000000000000000000 #define MOD 1000000007 #define eps (1e-9) #define int long long int #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) using namespace std; int n, aa, bb, mx, ans; vector<int> a; vector<pii> es; int solve() { ans = mx = 0; rep(i, 1, n) mx = max(mx, a[i]), ans += a[i]; rep(i, 0, n-2) { aa = es[i].first, bb = es[i].second; ans += max(a[aa], a[bb]); } ans -= mx; return ans; } signed main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n, a.resize(n + 1); rep(i, 1, n) cin >> a[i]; rep(i, 1, n-1) cin >> aa >> bb, es.push_back(pii(aa, bb)); cout << solve() <<"\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

sjekira.cpp:2: warning: ignoring #pragma loop  [-Wunknown-pragmas]
    2 | #pragma loop-opt(on)
      | 
sjekira.cpp:3: warning: ignoring #pragma GCC optmize [-Wunknown-pragmas]
    3 | #pragma GCC optmize("Ofast")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...