#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
ll readint(){
ll x=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int n;
int a[100005];
int main(){
n=readint();
for(int i=1;i<=n;i++) a[i]=readint();
sort(a+1,a+n+1);
ll ans=0;
for(int i=2;i<=n;i++) ans+=a[i]+a[1];
printf("%lld\n",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
860 KB |
Output is correct |
3 |
Correct |
5 ms |
1808 KB |
Output is correct |
4 |
Correct |
4 ms |
1628 KB |
Output is correct |
5 |
Correct |
5 ms |
1628 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
452 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
456 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
860 KB |
Output is correct |
3 |
Correct |
5 ms |
1808 KB |
Output is correct |
4 |
Correct |
4 ms |
1628 KB |
Output is correct |
5 |
Correct |
5 ms |
1628 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
452 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
456 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
860 KB |
Output is correct |
22 |
Correct |
6 ms |
1852 KB |
Output is correct |
23 |
Correct |
4 ms |
1576 KB |
Output is correct |
24 |
Correct |
9 ms |
1476 KB |
Output is correct |
25 |
Correct |
10 ms |
1708 KB |
Output is correct |
26 |
Correct |
9 ms |
1628 KB |
Output is correct |
27 |
Correct |
10 ms |
1628 KB |
Output is correct |
28 |
Correct |
10 ms |
1628 KB |
Output is correct |
29 |
Correct |
11 ms |
1884 KB |
Output is correct |
30 |
Correct |
5 ms |
1624 KB |
Output is correct |