RT ,这份代码本地一会RE一会过
过程:刚开始 RE 反复调第28行27列 printf 里的取址符 (删除再填上,重复好几次)后竟然不RE
代码:
#include<bits/stdc++.h>
using namespace std;
int aa[105][105];
struct sj{
string ab;
}sz[10500];
int n,m,t;
int a,b,c,d,e,f;
int main(){
scanf("%d%d%d",&n,&m,&t);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%s",&sz[n*(i-1)+j].ab);
aa[i][j]=n*(i-1)+j;
}
}
while(t){
t--;
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
for(int i=0;i<=e-1;i++){
for(int j=0;j<=f-1;j++){
swap(aa[a+i][b+j],aa[c+i][d+j]);
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
printf("%s ",&sz[aa[i][j]].ab);
}
printf("\n");
}
return 0;
}
样例:
4 4 2
a a b b
a a b b
c c d d
c c d d
1 1 3 3 2 2
3 1 1 3 2 2