# include <bits/stdc++.h>
# define mkp make_pair
# define ff first
# define ss second
# define pll pair <ll, ll>
# define pii pair <int, int>
# define vec vector
# define pb push_back
# define pf push_front
# define ppb pop_back
# define ppf pop_front
# define all(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
# define sz(x) ((int)(x).size())
# define lb lower_bound
# define ub upper_bound
# define br break
# define rt return
# define cn continue
# define nl "\n"
# define off exit(0)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll MAXN = 3e5 + 25;
const ll MAXL = 18 + 0;
const ll INF1 = 1e18 + 0;
const ll INF2 = 2e9 + 0;
const ll MOD = 1e9 + 7;
const ll M0D = 998244353;
const ld PI = acos((ld) -1);
const ll P = 67 + 0 + 0;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
using namespace std;
void ma1n ()
{
ll n;
cin >> n;
ll a[n + 3];
ll sum = 0, mn = INF1;
for (ll i = 1; i <= n; ++i)
{
cin >> a[i];
sum += a[i];
mn = min(mn, a[i]);
}
ll ans = sum + mn * (n - 2);
cout << ans << nl;
}
int main (/*?*/)
{
int zxc = 1;
// cin >> zxc;
while (zxc--)
{
ma1n();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
15 ms |
1028 KB |
Output is correct |
3 |
Correct |
36 ms |
980 KB |
Output is correct |
4 |
Correct |
31 ms |
980 KB |
Output is correct |
5 |
Correct |
38 ms |
980 KB |
Output is correct |
6 |
Correct |
30 ms |
980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
15 ms |
1028 KB |
Output is correct |
3 |
Correct |
36 ms |
980 KB |
Output is correct |
4 |
Correct |
31 ms |
980 KB |
Output is correct |
5 |
Correct |
38 ms |
980 KB |
Output is correct |
6 |
Correct |
30 ms |
980 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
14 ms |
980 KB |
Output is correct |
22 |
Correct |
37 ms |
980 KB |
Output is correct |
23 |
Correct |
43 ms |
1052 KB |
Output is correct |
24 |
Correct |
35 ms |
988 KB |
Output is correct |
25 |
Correct |
37 ms |
1060 KB |
Output is correct |
26 |
Correct |
43 ms |
984 KB |
Output is correct |
27 |
Correct |
35 ms |
980 KB |
Output is correct |
28 |
Correct |
31 ms |
992 KB |
Output is correct |
29 |
Correct |
35 ms |
980 KB |
Output is correct |
30 |
Correct |
35 ms |
980 KB |
Output is correct |