#include<bits/stdc++.h>
using namespace std;
using lol=long long int;
#define endl "\n"
const lol mod1=1e9+7,mod2=998244353,mod3=1000000000000000003;
const lol inf=1e18+8;
const double eps=1e-12;
const double PI=acos(-1.0);
const int N=3e5+5;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
typedef tree<pair<int,int>,null_type,less<pair<int,int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int _=1;
//cin>>_;
while(_--)
{
int n;
cin>>n;
vector<lol> v(n);
for(auto& e:v) cin>>e;
sort(v.rbegin(),v.rend());
lol ans=0;
for(int i=0;i<n;i++)
{
ans+=(i%3==2?0:v[i]);
}
cout<<ans;
}
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
12 ms |
1488 KB |
Output is correct |
7 |
Correct |
7 ms |
1492 KB |
Output is correct |
8 |
Correct |
10 ms |
1492 KB |
Output is correct |
9 |
Correct |
14 ms |
1612 KB |
Output is correct |
10 |
Correct |
15 ms |
1612 KB |
Output is correct |