# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
974199 | 2024-05-03T05:55:16 Z | sleepntsheep | Akcija (COCI15_akcija) | C | 8 ms | 860 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 856 KB | Output is correct |
7 | Correct | 7 ms | 676 KB | Output is correct |
8 | Correct | 7 ms | 676 KB | Output is correct |
9 | Correct | 8 ms | 860 KB | Output is correct |
10 | Correct | 8 ms | 856 KB | Output is correct |