Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- firstLine = input().split()
- secondLine = input().split()
- count = int(firstLine[0])
- allTime = int(firstLine[1])
- relaxTime = int(firstLine[2])
- times = [int(item) for item in secondLine]
- hardTime = -1
- for i in range(count):
- allTime -= times[i]
- if allTime >= 0:
- times.pop()
- relaxCount = allTime // relaxTime
- times.sort()
- if relaxCount - 1 >= count - 1:
- hardTime = 1
- else:
- if (len(times) == 0):
- hardTime = 1
- else:
- hardTime = times[-1 - relaxCount] + 1
- elif allTime < 0:
- hardTime = -1
- print(hardTime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement