Submission #357893

# Submission time Handle Problem Language Result Execution time Memory
357893 2021-01-24T23:19:08 Z beepbeepsheep Akcija (COCI15_akcija) C++17
80 / 80
18 ms 1644 KB
#include <bits/stdc++.h>

using namespace std;
#define ll long long

const ll bignum=1e17;
const int inf= 2e9;
const int mod= 1e9+7;


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll arr[n];
    for (int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    reverse(arr,arr+n);
    ll ans=0;
    for (int i=0;i<n;i++){
        if (!((i+1)%3))continue;
        ans+=arr[i];

    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 14 ms 1644 KB Output is correct
7 Correct 10 ms 1516 KB Output is correct
8 Correct 10 ms 1516 KB Output is correct
9 Correct 18 ms 1644 KB Output is correct
10 Correct 18 ms 1644 KB Output is correct