#include<bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin>>N;
long long int V[N];
long long int somma = 0;
for(int i = 0;i<N;i++) {cin>>V[i];somma+=V[i];}
sort(V, V+N);
for(int i = N-3;i>=0;i-=3)
{
somma-=V[i];
}
cout<<somma;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
42 ms |
1400 KB |
Output is correct |
7 |
Correct |
36 ms |
1404 KB |
Output is correct |
8 |
Correct |
36 ms |
1528 KB |
Output is correct |
9 |
Correct |
53 ms |
1656 KB |
Output is correct |
10 |
Correct |
51 ms |
1656 KB |
Output is correct |