#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int &x : a) {
cin >> x;
}
sort(a.begin(), a.end());
cout << accumulate(a.begin(), a.end(), 0ll) + 1ll * a[0] * (n - 2) << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
804 KB |
Output is correct |
3 |
Correct |
15 ms |
1684 KB |
Output is correct |
4 |
Correct |
10 ms |
1484 KB |
Output is correct |
5 |
Correct |
16 ms |
1552 KB |
Output is correct |
6 |
Correct |
10 ms |
1424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
324 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
804 KB |
Output is correct |
3 |
Correct |
15 ms |
1684 KB |
Output is correct |
4 |
Correct |
10 ms |
1484 KB |
Output is correct |
5 |
Correct |
16 ms |
1552 KB |
Output is correct |
6 |
Correct |
10 ms |
1424 KB |
Output is correct |
7 |
Correct |
1 ms |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
320 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
324 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
7 ms |
836 KB |
Output is correct |
22 |
Correct |
14 ms |
1612 KB |
Output is correct |
23 |
Correct |
11 ms |
1604 KB |
Output is correct |
24 |
Correct |
15 ms |
1564 KB |
Output is correct |
25 |
Correct |
17 ms |
1580 KB |
Output is correct |
26 |
Correct |
15 ms |
1484 KB |
Output is correct |
27 |
Correct |
16 ms |
1596 KB |
Output is correct |
28 |
Correct |
15 ms |
1412 KB |
Output is correct |
29 |
Correct |
19 ms |
1572 KB |
Output is correct |
30 |
Correct |
14 ms |
1544 KB |
Output is correct |