#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N;
cin >> N;
long long int prices[N], paid = 0;
for (int i = 0; i < N; i++) {
cin >> prices[i];
paid += prices[i];
}
sort(prices, prices+N, greater<int>());
for (int i = 2; i < N; i += 3)
paid -= prices[i];
cout << paid;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
30 ms |
1132 KB |
Output is correct |
7 |
Correct |
26 ms |
1132 KB |
Output is correct |
8 |
Correct |
25 ms |
1132 KB |
Output is correct |
9 |
Correct |
37 ms |
1132 KB |
Output is correct |
10 |
Correct |
36 ms |
1132 KB |
Output is correct |