#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define FOR(i,N) for(i=0;i<N;i++)
#define FORe(i,N) for(i=1;i<=N;i++)
#define FORr (i,a,b) for(i=a;i<b;i++)
#define vi vector <ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define mp make_pair
#define pb push_back
using namespace std;
const ll MAXN = 1e5+ 4;
const ll LOGN = 17;
const ll ROOTN = 320;
const ll MOD = 1e9+7;
const ll INF = 1e17+8;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll N,i,sum = 0;
cin>>N;
priority_queue<ll> p;
while(N--)
{
cin>>i;
p.push(i);
}
i = 1;
while(p.size())
{
if((i++)%3)
sum+=p.top();
p.pop();
}
cout<<sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
28 ms |
1908 KB |
Output is correct |
7 |
Correct |
16 ms |
1908 KB |
Output is correct |
8 |
Correct |
16 ms |
1904 KB |
Output is correct |
9 |
Correct |
30 ms |
2036 KB |
Output is correct |
10 |
Correct |
30 ms |
1956 KB |
Output is correct |