#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector <int> nums(n);
for (int i = 0; i < n; i++)
cin >> nums[i];
sort(nums.begin(), nums.end());
ll ans = 0;
for (int i = n-1, x = 0; i >= 0; i--) {
if (x == 0 && i-2 >= 0)
continue;
ans += nums[i];
x++;
x%=3;
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
17 ms |
840 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
600 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
600 KB |
Output isn't correct |
9 |
Incorrect |
21 ms |
604 KB |
Output isn't correct |
10 |
Incorrect |
21 ms |
600 KB |
Output isn't correct |