Submission #165017

# Submission time Handle Problem Language Result Execution time Memory
165017 2019-11-24T16:44:49 Z Rouge_Hugo Akcija (COCI15_akcija) C++14
80 / 80
67 ms 1300 KB
    #include <bits/stdc++.h>
    #define ll long long
    #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    int n;
    int a[100009];
    int main()
    {
        cin>>n;
        ll sum=0;
        for(int i=0;i<n;i++)cin>>a[i];
        sort(a,a+n);
        int re=0;
        for(int i=n-1;i>-1;i--)
        {
            re%=3;
            if (re==2){re++;continue;}
            sum+=a[i];
            re++;

        }
        cout<<sum;
    }
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 45 ms 1032 KB Output is correct
7 Correct 42 ms 1128 KB Output is correct
8 Correct 50 ms 1144 KB Output is correct
9 Correct 61 ms 1300 KB Output is correct
10 Correct 67 ms 1272 KB Output is correct