#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
int v[100001];
int n;
ll ans;
ll mi = LLONG_MAX; int min_index;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> v[i];
if(v[i] < mi) {
min_index = i;
mi = v[i];
}
}
for(int i = 1; i <= n; i++) {
if(i != min_index) ans += v[i] + mi;
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
324 KB |
Output is correct |
2 |
Correct |
5 ms |
852 KB |
Output is correct |
3 |
Correct |
16 ms |
1620 KB |
Output is correct |
4 |
Correct |
9 ms |
1492 KB |
Output is correct |
5 |
Correct |
12 ms |
1608 KB |
Output is correct |
6 |
Correct |
9 ms |
1500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
324 KB |
Output is correct |
2 |
Correct |
5 ms |
852 KB |
Output is correct |
3 |
Correct |
16 ms |
1620 KB |
Output is correct |
4 |
Correct |
9 ms |
1492 KB |
Output is correct |
5 |
Correct |
12 ms |
1608 KB |
Output is correct |
6 |
Correct |
9 ms |
1500 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
6 ms |
852 KB |
Output is correct |
22 |
Correct |
12 ms |
1672 KB |
Output is correct |
23 |
Correct |
12 ms |
1632 KB |
Output is correct |
24 |
Correct |
9 ms |
1568 KB |
Output is correct |
25 |
Correct |
10 ms |
1584 KB |
Output is correct |
26 |
Correct |
10 ms |
1492 KB |
Output is correct |
27 |
Correct |
10 ms |
1576 KB |
Output is correct |
28 |
Correct |
9 ms |
1484 KB |
Output is correct |
29 |
Correct |
9 ms |
1612 KB |
Output is correct |
30 |
Correct |
12 ms |
1540 KB |
Output is correct |