#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 100001;
int n;
int arr[MAXN];
long long sol = 0;
int Solve(){
int cnt = 0;
for(int i = n-1; i >= 0; i--){
cnt++;
if(cnt % 3 == 0){
continue;
}
else sol += arr[i];
}
return sol;
}
int main(){
cin >> n;
for(int i = 0; i < n; i++){
cin >> arr[i];
}
sort(arr,arr+n);
cout << Solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
420 KB |
Output is correct |
4 |
Correct |
2 ms |
440 KB |
Output is correct |
5 |
Correct |
3 ms |
516 KB |
Output is correct |
6 |
Correct |
34 ms |
1308 KB |
Output is correct |
7 |
Correct |
56 ms |
1704 KB |
Output is correct |
8 |
Correct |
29 ms |
2220 KB |
Output is correct |
9 |
Correct |
46 ms |
2928 KB |
Output is correct |
10 |
Correct |
48 ms |
3420 KB |
Output is correct |