# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
382939 | Alexandra | Akcija (COCI15_akcija) | Cpython 3 | 282 ms | 7320 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.
n = int(input())
books = []
resp = 0
for i in range (n):
books.append(int(input()))
books.sort(reverse=True)
mod = n%3
if mod==0:
groups = n//3
else:
groups = n//3 + 1
cont = 1
for i in range (0, n, 3):
resp += books[i]
if cont == groups:
if mod==2 or mod == 0:
resp += books[i+1]
else:
resp += books[i+1]
cont += 1
print (str(resp))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |