This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;
#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif
signed main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    #ifdef JASPER
        freopen("in1", "r", stdin);
    #endif
    int n;
    cin >> n;
    if (n == 1) {
        cout << "0\n";
        return 0;
    }
    vector <int> d(n);
    for (int& x : d) cin >> x;
    sort(d.begin(), d.end());
    ll ans = 0;
    for (int i = 1; i < n; ++i)
        ans += d[i] + d[0];
    cout << ans << "\n";
    
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |