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 ll long long
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const ll maxn = 5e5+5;
const ll add = 1e5;
ll n;
ll A[maxn];
void solve()
{
cin >> n;
ll sum = 0;
ll value = LLONG_MAX;
for(int i = 1; i<= n; i++)
{
cin >> A[i];
sum += A[i];
value = min(value, A[i]);
}
sum -= value;
sum += (n-1)*value;
cout << sum;
}
int main()
{
ios_base::sync_with_stdio(NULL) ; cin.tie(nullptr) ; cout.tie(nullptr);
ll test_case = 1;
while(test_case--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |