#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a[100000], v=0;
cin >> n;
for (int i=0; i<n; i++)
cin >> a[i];
sort(a, a+n);
for (int i=0; i<n; i++)
v+=a[i];
for (int i = n - 3; i>=0; i-=3)
{
v=v-a[i];
}
cout << v;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
26 ms |
1108 KB |
Output is correct |
7 |
Correct |
21 ms |
1000 KB |
Output is correct |
8 |
Correct |
21 ms |
1024 KB |
Output is correct |
9 |
Correct |
32 ms |
1196 KB |
Output is correct |
10 |
Correct |
36 ms |
1128 KB |
Output is correct |