#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
#define LOCALIO "C:/Users/admin/Documents/Code/"
ll a[100005];
int main()
{
#ifdef LOCAL
freopen( LOCALIO "input.txt","r",stdin) ;
freopen( LOCALIO "output.txt","w",stdout) ;
#endif
ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
// freopen("FIBONACCI.inp","r",stdin);
// freopen("FIBONACCI.out","w",stdout);
ll n; cin >> n;
for (ll i=1; i<=n; i++)
cin >> a[i];
sort(a+1, a+n+1);
ll ans=0;
for (ll i=2; i<=n; i++)
ans+=a[i]+a[1];
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
5 ms |
980 KB |
Output is correct |
3 |
Correct |
12 ms |
980 KB |
Output is correct |
4 |
Correct |
10 ms |
980 KB |
Output is correct |
5 |
Correct |
10 ms |
1016 KB |
Output is correct |
6 |
Correct |
10 ms |
964 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 |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 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 |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
5 ms |
980 KB |
Output is correct |
3 |
Correct |
12 ms |
980 KB |
Output is correct |
4 |
Correct |
10 ms |
980 KB |
Output is correct |
5 |
Correct |
10 ms |
1016 KB |
Output is correct |
6 |
Correct |
10 ms |
964 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 |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
0 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 |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
5 ms |
980 KB |
Output is correct |
22 |
Correct |
15 ms |
1068 KB |
Output is correct |
23 |
Correct |
11 ms |
1004 KB |
Output is correct |
24 |
Correct |
14 ms |
980 KB |
Output is correct |
25 |
Correct |
16 ms |
1088 KB |
Output is correct |
26 |
Correct |
14 ms |
1004 KB |
Output is correct |
27 |
Correct |
16 ms |
1108 KB |
Output is correct |
28 |
Correct |
14 ms |
980 KB |
Output is correct |
29 |
Correct |
16 ms |
1008 KB |
Output is correct |
30 |
Correct |
12 ms |
980 KB |
Output is correct |