# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974199 | sleepntsheep | Akcija (COCI15_akcija) | C11 | 8 ms | 860 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |