Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. n, m, k = map(int, input().split())
  2. x = k+1
  3. y = k+1
  4. a = []
  5. for i in range(k):
  6.     ri, ci = map(int, input().split())
  7.     a.append([ri, ci])
  8. for i in range(2):
  9.     for j in range(k-1):
  10.         if (a[0][j]-a[0][j+1] == 0) or (a[0][j]-a[0][j+1] == 1):
  11.             x = x-1
  12. for i in range(2):
  13.     for j in range (k-1):
  14.         if (a[1][j]-a[1][j+1] == 0) or (a[1][j]-a[1][j+1] == 1):
  15.             y = y-1
  16. print(x*y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement