Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. n = int(input())
  2.  
  3. num = 0
  4. changed = False
  5. changedNum = 0
  6. for i in range(0, 2 * n):
  7. command = input()
  8. if command == 'remove':
  9. num -= 1
  10. if changed:
  11. changedNum += 1
  12. changed = False
  13. else:
  14. boxNum = int(command.split(' ')[1])
  15. if num == 0:
  16. minNum = boxNum
  17.  
  18. if boxNum > minNum:
  19. changed = True
  20.  
  21. num += 1
  22.  
  23. print(changedNum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement