8520 | 2024-01-20 10:59:06 | baktucsok | Pontos átlag 2 | python3 | Time limit exceeded 10/100 | 2.099s | 57468 KiB |
import sys
import math
db, ar = list(map(int, input().strip().split()))
y = list(map(int, input().strip().split()))
s = sum(y)
Z=0
a = 0
m = min(y)
b=0
if s < ar*db:
print(math.ceil((ar*db-s)/db))
elif s == ar*db:
print(0)
else:
if min(y) > math.ceil((s-ar*db)/db):
print(math.ceil((s-ar*db)/db))
else:
while s-b+m*len(y)> ar*db and len(y)>1:
m= min(y)
Z+=(m-1)
for i in range(len(y)):
y[i]-= (m-1)
b+=(len(y)*(m-1))
for i in range(y.count(1)):
y.remove(1)
while s-a-b > db*ar:
for i in range(len(y)):
if y[i] > 1:
y[i]-=1
a+=1
Z+=1
print(Z)
sys.stdout.close()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 19ms | 11432 KiB | ||||
2 | Accepted | 19ms | 11504 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 17ms | 11920 KiB | ||||
4 | Accepted | 17ms | 12328 KiB | ||||
5 | Accepted | 18ms | 12304 KiB | ||||
6 | Accepted | 17ms | 12664 KiB | ||||
7 | Accepted | 17ms | 12476 KiB | ||||
8 | Accepted | 17ms | 12848 KiB | ||||
subtask3 | 0/20 | ||||||
9 | Accepted | 59ms | 20620 KiB | ||||
10 | Time limit exceeded | 2.059s | 9324 KiB | ||||
11 | Accepted | 57ms | 19764 KiB | ||||
12 | Time limit exceeded | 2.075s | 9052 KiB | ||||
13 | Accepted | 59ms | 20988 KiB | ||||
14 | Time limit exceeded | 2.075s | 9596 KiB | ||||
15 | Time limit exceeded | 2.068s | 9428 KiB | ||||
16 | Time limit exceeded | 2.048s | 9660 KiB | ||||
17 | Accepted | 18ms | 13428 KiB | ||||
subtask4 | 0/24 | ||||||
18 | Wrong answer | 86ms | 13560 KiB | ||||
19 | Wrong answer | 104ms | 13592 KiB | ||||
20 | Wrong answer | 32ms | 13792 KiB | ||||
21 | Wrong answer | 146ms | 13732 KiB | ||||
22 | Wrong answer | 128ms | 13796 KiB | ||||
23 | Accepted | 17ms | 13624 KiB | ||||
24 | Accepted | 17ms | 13688 KiB | ||||
25 | Accepted | 17ms | 13916 KiB | ||||
26 | Wrong answer | 57ms | 14104 KiB | ||||
27 | Wrong answer | 74ms | 13904 KiB | ||||
28 | Accepted | 18ms | 14060 KiB | ||||
subtask5 | 0/46 | ||||||
29 | Time limit exceeded | 2.099s | 10004 KiB | ||||
30 | Time limit exceeded | 2.056s | 28876 KiB | ||||
31 | Time limit exceeded | 2.079s | 19204 KiB | ||||
32 | Accepted | 78ms | 49780 KiB | ||||
33 | Time limit exceeded | 2.052s | 28268 KiB | ||||
34 | Time limit exceeded | 2.076s | 28160 KiB | ||||
35 | Accepted | 93ms | 57468 KiB | ||||
36 | Time limit exceeded | 2.065s | 28412 KiB | ||||
37 | Time limit exceeded | 2.072s | 28236 KiB | ||||
38 | Accepted | 92ms | 57016 KiB | ||||
39 | Time limit exceeded | 2.088s | 14224 KiB | ||||
40 | Wrong answer | 1.958s | 15356 KiB | ||||
41 | Accepted | 17ms | 14720 KiB |