python求助,紫了一片
查看原帖
python求助,紫了一片
1393994
Lambency楼主2024/8/17 16:55
h, l = map(int, input().strip().split())
t = [[0 for i in range(l+2)]]
for i in range(h):
    t.append(list(map(int, ('0 '+input().strip()+' 0').split())))
t.append([[0 for i in range(l+2)]])
for i in range(int(input().strip())):
    x1, y1, x2, y2 = map(int, input().strip().split())
    t[x1][y1], t[x2][y2] = t[x2][y2], t[x1][y1]
j = 0
o = []
for hx in range(1, h+1):
    for lx in range(1, l+1):
        if t[hx][lx] > t[hx-1][lx] and t[hx][lx] > t[hx+1][lx] and t[hx][lx] > t[hx][lx-1] and t[hx][lx] > t[hx][lx+1]:
            j += 1
            o.append(f'{hx} {lx}')
print(j)
print(*o, sep='\n')

2024/8/17 16:55
加载中...