Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. bank = [0, 0, 0]
  2. time = []
  3. n = int(input())
  4. for i in range(n):
  5. x, y = map(int, input().split())
  6. time.append(x * 60 + y)
  7. for i in range(n):
  8. r = min(bank)
  9. ind = 0
  10. for j in range(3):
  11. if bank[j] == r:
  12. ind = j
  13. if bank[ind] > time[i]:
  14. x = bank[ind] + 30
  15. print(x // 60, x % 60)
  16. else:
  17. x = time[i] + 30
  18. print(x // 60, x % 60)
  19. bank[ind] = max(time[i], bank[ind]) + 30
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement