Submission #974199

#TimeUsernameProblemLanguageResultExecution timeMemory
974199sleepntsheepAkcija (COCI15_akcija)C11
80 / 80
8 ms860 KiB
#include<stdio.h> #define N 100000 int n, a[N+1], b[N], o; long long z; int main() { scanf("%d",&n); for(int x,i=0;i<n;++i)scanf("%d",&x),++a[x]; for(int i=1;i<=100000;++i)while(a[i])--a[i],b[o++]=i; while(o>=3)z+=b[o-1]+b[o-2],o-=3; if(o>=2)z+=b[1]; if(o>=1)z+=b[0]; printf("%lld\n",z); }

Compilation message (stderr)

akcija.c: In function 'main':
akcija.c:9:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
akcija.c:10:27: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for(int x,i=0;i<n;++i)scanf("%d",&x),++a[x];
      |                           ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...