fork download
  1. __author__ = 'Zlobober'
  2. n, m, q = map(int, raw_input().split())
  3. F = [list(map(int, raw_input().split())) for i in range(n)]
  4.  
  5. def calc(i):
  6. ans = 0
  7. l = -1
  8. for j in range(m):
  9. if F[i][j] == 0:
  10. l = j
  11. else:
  12. ans = max(ans, j - l)
  13. return ans
  14.  
  15. row = list(map(calc, range(n)))
  16.  
  17. for i in range(q):
  18. y, x = map(int, raw_input().split())
  19. y -= 1
  20. x -= 1
  21. F[y][x] = 1 - F[y][x]
  22. row[y] = calc(y)
  23. print max(row)
  24.  
  25.  
Runtime error #stdin #stdout #stderr 0.01s 7736KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 2, in <module>
EOFError: EOF when reading a line