#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <long double, pii> muchie;
const ll NMAX = 1000001;
const ll VMAX = 1001;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 447;
const ll base = 31;
const ll nr_of_bits = 21;
ll v[NMAX];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, i;
ll sum = 0;
cin >> n;
for(i = 1; i <= n; i++) cin >> v[i];
sort(v + 1, v + n + 1);
reverse(v + 1, v + n + 1);
for(i = 1; i <= n; i++){
if(i % 3 == 0) continue;
sum += v[i];
}
cout << sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
212 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 |
12 ms |
1424 KB |
Output is correct |
7 |
Correct |
8 ms |
1496 KB |
Output is correct |
8 |
Correct |
7 ms |
1424 KB |
Output is correct |
9 |
Correct |
18 ms |
1628 KB |
Output is correct |
10 |
Correct |
15 ms |
1620 KB |
Output is correct |