Submission #1076854

# Submission time Handle Problem Language Result Execution time Memory
1076854 2024-08-26T17:21:20 Z toast12 Akcija (COCI15_akcija) C++14
80 / 80
23 ms 1392 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<int> nums(n);
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
        ans += nums[i];
    }
    sort(nums.begin(), nums.end());
    reverse(nums.begin(), nums.end());
    for (int i = 0; i < n; i++) {
        if (i % 3 == 2)
            ans -= nums[i];
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 17 ms 1208 KB Output is correct
7 Correct 14 ms 1116 KB Output is correct
8 Correct 21 ms 1204 KB Output is correct
9 Correct 23 ms 1392 KB Output is correct
10 Correct 22 ms 1368 KB Output is correct