Submission #604127

# Submission time Handle Problem Language Result Execution time Memory
604127 2022-07-24T18:43:02 Z Hussein3600 Akcija (COCI15_akcija) C++14
40 / 80
20 ms 704 KB
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n ;
    cin >> n ;
    int a[n] , total=0 , best ;
    for(int i=0;i<n;i++)cin>>a[i] ,total+=a[i];
    sort(a,a+n) ;
    for(int i=0;i<n;i+=3)total-=a[i] ;
    if(n%3==0)
    cout<<total<<endl;
    else cout<<total+a[n-1];
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:9:26: warning: unused variable 'best' [-Wunused-variable]
    9 |     int a[n] , total=0 , best ;
      |                          ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 11 ms 596 KB Output is correct
7 Correct 7 ms 704 KB Output is correct
8 Correct 9 ms 704 KB Output is correct
9 Incorrect 20 ms 596 KB Output isn't correct
10 Incorrect 14 ms 596 KB Output isn't correct