Submission #292360

# Submission time Handle Problem Language Result Execution time Memory
292360 2020-09-06T21:40:36 Z MilosMilutinovic Akcija (COCI15_akcija) C++14
80 / 80
24 ms 1280 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%i",&n);
    int a[n];
    long long sum=0;
    for(int i=0;i<n;i++)scanf("%i",&a[i]),sum+=a[i];
    sort(a,a+n);
    reverse(a,a+n);
    for(int i=2;i<n;i+=3)sum-=a[i];
    printf("%lld",sum);
    return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
akcija.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(int i=0;i<n;i++)scanf("%i",&a[i]),sum+=a[i];
      |                         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 19 ms 1152 KB Output is correct
7 Correct 14 ms 1152 KB Output is correct
8 Correct 14 ms 1152 KB Output is correct
9 Correct 24 ms 1280 KB Output is correct
10 Correct 24 ms 1280 KB Output is correct