#include <bits/stdc++.h>
using namespace std;
int a[1001000];
int main()
{
int n;
cin>>n;
int g=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
g+=a[i];
}
sort(a+1,a+n+1);
reverse(a+1,a+1+n);
for(int i=1;i<=n;i++)
{
if(i%3)
continue;
g-=a[i];
}
cout<<g<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
300 KB |
Output is correct |
6 |
Correct |
30 ms |
964 KB |
Output is correct |
7 |
Correct |
28 ms |
1072 KB |
Output is correct |
8 |
Correct |
27 ms |
1080 KB |
Output is correct |
9 |
Correct |
43 ms |
1172 KB |
Output is correct |
10 |
Correct |
39 ms |
1144 KB |
Output is correct |