# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
696601 |
2023-02-07T01:05:12 Z |
mousey |
Autići (COCI22_autici) |
C++14 |
|
12 ms |
1336 KB |
#include <bits/stdc++.h>
#define int long long
#define vi vector <int>
#define vv vector <vi>
#define pi pair <int, int>
#define vip vector <pi>
#define pb push_back
#define f first
#define s second
#define nl cout<<"\n"
using namespace std;
const int mod=1e9+7;
const double eps=1e-9;
const int N=1e5;
int n, d[N+5];
int sum=0;
void input()
{
cin >> n;
for(int i = 1; i <= n; i++) cin >> d[i], sum+=d[i];
}
void solve()
{
sort(d+1, d+n+1);
if(n==1) sum=0;
else sum*=2, sum-=d[n]+d[n-1];
cout << sum;
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
// freopen("math.inp", "r", stdin);
// freopen("math.out", "w", stdout);
// cin >> t;
for(int i = 1; i <= t; i++)
{
input();
solve();
nl;
}
}
/*
6
a
b
c
d
e
f
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
6 ms |
1236 KB |
Output is correct |
3 |
Correct |
12 ms |
1304 KB |
Output is correct |
4 |
Correct |
10 ms |
1268 KB |
Output is correct |
5 |
Correct |
12 ms |
1336 KB |
Output is correct |
6 |
Correct |
9 ms |
1216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
6 ms |
1236 KB |
Output is correct |
3 |
Correct |
12 ms |
1304 KB |
Output is correct |
4 |
Correct |
10 ms |
1268 KB |
Output is correct |
5 |
Correct |
12 ms |
1336 KB |
Output is correct |
6 |
Correct |
9 ms |
1216 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 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 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |