Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- ships = 0
- rows = []
- for i in range(n):
- row = [int(x) for x in input().split()]
- rows.append(row)
- squares = input().split()
- for spot in squares:
- spot = [int(x) for x in spot.split('-')]
- row_place = spot[0]
- col_place = spot[1]
- if rows[row_place][col_place] > 0:
- rows[row_place][col_place] -= 1
- if rows[row_place][col_place] == 0:
- ships += 1
- print(ships)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement