Advertisement
zogzog

Untitled

Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. import sys
  2.  
  3. ontrain = 0
  4. x = sys.stdin.readline()
  5. y = x.split()
  6. cap = int(y[0])
  7. b = int(y[1])
  8.  
  9. for i in range(0, b):
  10.   z = sys.stdin.readline()
  11.   g = z.split()
  12.   left = int(g[0])
  13.   enter = int(g[1])
  14.   stay = int(g[2])
  15.  
  16.   print(g)
  17.  
  18.  
  19.   if left > ontrain:
  20.       print("impossible")
  21.       break
  22.   else:
  23.       ontrain =- left
  24.  
  25.  
  26.   if enter+ontrain > cap+1:
  27.       print("impossible")
  28.       break
  29.   else:
  30.       ontrain =+ enter
  31.      
  32.   space = cap-ontrain
  33.  
  34.   if i == b-1:
  35.    break
  36.   elif stay < space:
  37.       print("impossible")
  38.       break
  39.   else:
  40.       ontrain += stay -space
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement