#include <bits/stdc++.h>
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
11 ms |
1108 KB |
Output is correct |
7 |
Correct |
9 ms |
1128 KB |
Output is correct |
8 |
Correct |
7 ms |
1064 KB |
Output is correct |
9 |
Correct |
15 ms |
1288 KB |
Output is correct |
10 |
Correct |
15 ms |
1236 KB |
Output is correct |