# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1084066 | overwatch9 | Akcija (COCI15_akcija) | C++17 | 24 ms | 836 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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--, x++) {
x %= 3;
if (x == 0 && i-2 >= 0)
continue;
ans += nums[i];
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |