tahamajs's picture
download
raw
366 Bytes
n,m,t = list(map(int,input().split()))
res =0
map = {}
while t:
x,y = input().split()
x,y = int(x),int(y)
if (x,y) not in map :
map[(x,y)] = True
res +=2
if (x-1,y) in map: res-=1
if (x+1,y) in map: res-=1
if (x,y-1) in map: res-=1
if (x,y+1) in map: res-=1
print(res)
t-=1

Xet Storage Details

Size:
366 Bytes
·
Xet hash:
7e58811aa79a05f832b081dfde192244e16e2362de0661c3f56d6d78afe48234

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.