n=int(input())
L=[int(input()) for i in range (n)]
L.sort()
L.reverse()
z=0
for i in range (n):
if i%3==2:
continue
else:
z+=L[i]
if n%3==1:
z+=L[n-1]
elif n%3==2:
z+=L[n-2]+L[n-1]
print(z)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
3300 KB |
Output isn't correct |
2 |
Incorrect |
25 ms |
3304 KB |
Output isn't correct |
3 |
Incorrect |
25 ms |
3300 KB |
Output isn't correct |
4 |
Correct |
26 ms |
3300 KB |
Output is correct |
5 |
Correct |
28 ms |
3396 KB |
Output is correct |
6 |
Correct |
321 ms |
7020 KB |
Output is correct |
7 |
Correct |
276 ms |
7416 KB |
Output is correct |
8 |
Incorrect |
282 ms |
7464 KB |
Output isn't correct |
9 |
Incorrect |
342 ms |
7776 KB |
Output isn't correct |
10 |
Incorrect |
337 ms |
7708 KB |
Output isn't correct |