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>
#define int long long
#define INF 0x3f3f3f3f
using namespace std;
void testCase() {
int n;
cin >> n;
int sum = 0, mn = INF;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
sum += x;
mn = min(mn, x);
}
cout << sum + mn * (n - 2) << '\n';
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tests = 1;
for (int tc = 0; tc < tests; ++tc) {
testCase();
}
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... |