奉上我的垃圾代码,简单是简单就是太长了
row,col = map(int,input().split())
tmp = [0 for _ in range(col)]
tmp2 = 0
matrix = [[0 for _ in range(col)]for _ in range(row)]
for i in range(row):
matrix[i]=list(map(int,input().split()))
opt = int(input())
command = [[0 for _ in range(3)]for _ in range(opt)]
for i in range(opt):
command[i] = input().split()
for i in command:
if(i[0]=='r'):
row1 = int(i[1])-1
row2 = int(i[2])-1
tmp = matrix[row1]
matrix[row1]=matrix[row2]
matrix[row2]=tmp
if(i[0]=='c'):
col1 = int(i[1])-1
col2 = int(i[2])-1
for i in range(row):
tmp2=matrix[i][col1]
matrix[i][col1]=matrix[i][col2]
matrix[i][col2]=tmp2
for i in range(row):
for j in range(col):
print(matrix[i][j],end=" ")
print()