#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>v(n);
for (int i=0; i<n; i++) cin>>v[i];
sort(v.begin(), v.end());
long long int ans=0;
for (int i=1; i<n; i++) ans+=v[0]+v[i];
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
15 ms |
852 KB |
Output is correct |
3 |
Correct |
39 ms |
1684 KB |
Output is correct |
4 |
Correct |
46 ms |
1416 KB |
Output is correct |
5 |
Correct |
54 ms |
1564 KB |
Output is correct |
6 |
Correct |
38 ms |
1364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 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 |
304 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
15 ms |
852 KB |
Output is correct |
3 |
Correct |
39 ms |
1684 KB |
Output is correct |
4 |
Correct |
46 ms |
1416 KB |
Output is correct |
5 |
Correct |
54 ms |
1564 KB |
Output is correct |
6 |
Correct |
38 ms |
1364 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 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 |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
304 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 |
852 KB |
Output is correct |
22 |
Correct |
38 ms |
1680 KB |
Output is correct |
23 |
Correct |
39 ms |
1576 KB |
Output is correct |
24 |
Correct |
48 ms |
1544 KB |
Output is correct |
25 |
Correct |
44 ms |
1572 KB |
Output is correct |
26 |
Correct |
40 ms |
1536 KB |
Output is correct |
27 |
Correct |
42 ms |
1576 KB |
Output is correct |
28 |
Correct |
39 ms |
1516 KB |
Output is correct |
29 |
Correct |
45 ms |
1572 KB |
Output is correct |
30 |
Correct |
41 ms |
1644 KB |
Output is correct |