#include <iostream>
#include <algorithm>
using namespace std;
int a[1000007];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
for(int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
int ans = 0;
for(int i = 0; i < n; i++){
if((n-i) % 3 == 0)
continue;
ans += a[i];
}
cout << ans << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
13 ms |
1068 KB |
Output is correct |
7 |
Correct |
8 ms |
1120 KB |
Output is correct |
8 |
Correct |
10 ms |
1032 KB |
Output is correct |
9 |
Correct |
16 ms |
1240 KB |
Output is correct |
10 |
Correct |
15 ms |
1236 KB |
Output is correct |