70AC30WA求条
查看原帖
70AC30WA求条
1436254
xingjielongSYH楼主2024/12/7 18:56
#include<bits/stdc++.h>
using namespace std;
int a[1010][1010],b[1010];
int main(){
	int n,m,p,x,y,z;
	char tmp;
	cin >> n >> m >> p;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> tmp;
			a[i][j]=tmp-'0';
		}
	}
	for(int i=1;i<=p;i++){
		cin >> x >> y >> z;
		if(x!=3){
			if(x==1){
				for(int j=1;j<=n;j++){
					swap(a[y][j],a[z][j]);
				}
			}else{
				for(int j=1;j<=n;j++){
					swap(a[j][y],a[j][z]);
				}
			}
		}else{
			cout<<a[y][z]<<endl; 
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}
2024/12/7 18:56
加载中...