#include <bits/stdc++.h>
using namespace std;
#define ff first
#define sc second
#define pb(x) push_back(x)
#define ll long long
#define sp ' '
#define pairs pair<int, int>
#define mp make_pair
int main(){
int n;
ll cnt=0;
cin>>n;
vector <int> v;
for(int i=0; i<n; i++){
int a;
cin>>a;
v.pb(a);
}
sort(v.begin(), v.end(),greater <int>());
for(int i=0; i<n; i++){
if(i%3==2){
}
else{
cnt+=v[i];
}
}
cout<<cnt;
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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
27 ms |
976 KB |
Output is correct |
7 |
Correct |
21 ms |
848 KB |
Output is correct |
8 |
Correct |
21 ms |
916 KB |
Output is correct |
9 |
Correct |
31 ms |
848 KB |
Output is correct |
10 |
Correct |
31 ms |
888 KB |
Output is correct |