Submission #251645

#TimeUsernameProblemLanguageResultExecution timeMemory
251645VEGAnnAkcija (COCI15_akcija)C++14
80 / 80
26 ms1280 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100100;
int n, a[N];

int main() {
#ifdef _LOCAL
    freopen("in.txt","r",stdin); // freopen("output.txt","w",stdout);
#else
//    freopen("mining.in","r",stdin); freopen("mining.out","w",stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a + n);
    reverse(a, a + n);

    ll ans = 0;

    for (int i = 0; i < n; i++)
        if (i % 3 != 2)
            ans += a[i];

    cout << ans;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...