Submission #469874

# Submission time Handle Problem Language Result Execution time Memory
469874 2021-09-02T08:11:50 Z Karabasan Akcija (COCI15_akcija) C++17
80 / 80
23 ms 1612 KB
#include <bits/stdc++.h>

using namespace std;
long long dizi[100005];
long long cevap;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&dizi[i]);
    sort(dizi+1,dizi+1+n);
    reverse(dizi+1,dizi+1+n);
    for(int i=1;i<=n;i++)
    {
        if(i%3==0)
            dizi[i]=0;
    }
    for(int i=1;i<=n;i++)
        cevap+=dizi[i];
    printf("%lld",cevap);
    return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
akcija.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%lld",&dizi[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 16 ms 1452 KB Output is correct
7 Correct 12 ms 1356 KB Output is correct
8 Correct 12 ms 1472 KB Output is correct
9 Correct 23 ms 1564 KB Output is correct
10 Correct 20 ms 1612 KB Output is correct