Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import heapq
- def main():
- n, x, k = map(int, input().split(" "))
- times = list(map(int, input().split(" ")))
- heapq.heapify(times)
- answers = []
- while k:
- v = heapq.heappop(times)
- heapq.heappush(times, v + x)
- if len(answers) == 0 or answers[len(answers)-1] != v:
- answers.append(v)
- k -= 1
- print(answers[k-1])
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement