Submission #531802

#TimeUsernameProblemLanguageResultExecution timeMemory
531802hgmhcAutići (COCI22_autici)C++17
50 / 50
14 ms2056 KiB
#include <bits/stdc++.h> using namespace std; using ii = pair<int,int>; using ll = long long; using ld = long double; #define _(x) const x& #define REP(i,a,b) for (auto i = (a); i <= (b); ++i) #define ZIP(x) (x).erase(unique((x).begin(),(x).end()),(x).end()) #define MP make_pair #define mup(x,y) x = min(x,y) #define Mup(x,y) x = max(x,y) #define size(x) int((x).size()) int main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; vector<ll> d(n); for (auto &x : d) cin >> x; // sort(d.begin(),d.end()); if (n == 1) { cout << 0; } else { ll mn = 2e9; REP(i,0,n-1) mup(mn,d[i]); cout << (n-2)*mn + accumulate(d.begin(),d.end(),0LL); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...