Submission #1130608

#TimeUsernameProblemLanguageResultExecution timeMemory
1130608lopkusAkcija (COCI15_akcija)C++20
80 / 80
14 ms1096 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a.begin() + 1, a.end());
    reverse(a.begin() + 1, a.end());
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(i % 3 == 0) {
            continue;
        }
        ans += a[i];
    }
    cout << ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...