Submission #94011

# Submission time Handle Problem Language Result Execution time Memory
94011 2019-01-14T16:17:20 Z theknife2001 Akcija (COCI15_akcija) C++17
80 / 80
37 ms 1272 KB
#include <bits/stdc++.h>

using namespace std;
const int N=1e5+55;
int a[N];


int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    long long ans=0;
    for(int i=n-1;i>=0;i-=3)
    {
        ans+=a[i];
        if(i-1>=0)
            ans+=a[i-1];
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 27 ms 1144 KB Output is correct
7 Correct 24 ms 1144 KB Output is correct
8 Correct 24 ms 1144 KB Output is correct
9 Correct 37 ms 1272 KB Output is correct
10 Correct 37 ms 1256 KB Output is correct