# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
382939 |
2021-03-28T14:52:21 Z |
Alexandra |
Akcija (COCI15_akcija) |
Python 3 |
|
282 ms |
7320 KB |
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 |
1 |
Correct |
17 ms |
2796 KB |
Output is correct |
2 |
Correct |
16 ms |
2796 KB |
Output is correct |
3 |
Correct |
19 ms |
2796 KB |
Output is correct |
4 |
Correct |
18 ms |
2796 KB |
Output is correct |
5 |
Correct |
21 ms |
2924 KB |
Output is correct |
6 |
Correct |
282 ms |
6572 KB |
Output is correct |
7 |
Correct |
219 ms |
6996 KB |
Output is correct |
8 |
Correct |
244 ms |
6996 KB |
Output is correct |
9 |
Correct |
248 ms |
7284 KB |
Output is correct |
10 |
Correct |
237 ms |
7320 KB |
Output is correct |