def turn(a,b):
b=[]
for k in range(0,len(a[0])):
ln = []
for l in range(len(a)-1,-1,-1):
ln.append(a[l][k])
b.append(ln)
return b
def updown(a,b):
b=[]
for k in range(len(a)-1,-1,-1):
line=[]
for l in range(len(a[0])):
line.append(a[k][l])
b.append(line)
return b
import sys
for i in sys.stdin:
a=[] #裝欲修正陣列
b=[] #裝修正後陣列
i=i.split()
for i in range(int(i[0])):
j=input().split()
j=[int(j) for j in j]
a.append(j)
k=input().split()
k=[int(k) for k in k]
for i in range(len(k)):
if k[i]==0:
b=turn(a,b)
a=b
elif k[i]==1:
b=updown(a,b)
a=b
#print(b)
print(len(b),len(b[0]))
for i in range(len(b)):
for j in range(len(b[0])):
if j==len(b[0])-1:
print(b[i][j],end='')
else:
print(b[i][j],end=' ')
print()
您的答案為: 2 6 2 9 6 正確答案為: 5 1 0 4 5