Submission #166415

# Submission time Handle Problem Language Result Execution time Memory
166415 2019-12-02T09:42:55 Z outsider Akcija (COCI15_akcija) C++14
80 / 80
67 ms 1656 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,s;
vector<ll>a;
main (){
    cin>>n;
    a.resize(n+1);
    ll ans=0;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans+=a[i];
    }
    sort(a.begin()+1,a.end());
    for (int i=n-2;i>=1;i-=3)
    {
        ans-=a[i];
    }

cout<<ans;
return 0;}

Compilation message

akcija.cpp:6:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main (){
       ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 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 1528 KB Output is correct
7 Correct 41 ms 1516 KB Output is correct
8 Correct 41 ms 1528 KB Output is correct
9 Correct 59 ms 1656 KB Output is correct
10 Correct 67 ms 1656 KB Output is correct