我提交了以下代码,想骗50分,一直找不到问题,最后写了assert(r == 1),获得了全部RE的结果,希望管理员帮忙调整数据。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 505;
int n, m;
int a[M][M];
int t[M][M];
void show() {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout << a[i][j] << " ";
}
cout << endl;
}
// cout << "---" << endl;
}
int main() {
cin >> n >> m;
int w = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) a[i][j] = ++w;
}
// show();
while (m--) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) t[i][j] = a[i][j];
}
int x, y, r, z;
cin >> x >> y >> r >> z;
assert(r == 1);
if (z == 1) {
t[x - 1][y - 1] = a[x - 1][y + 1];
t[x - 1][y] = a[x][y + 1];
t[x - 1][y + 1] = a[x + 1][y + 1];
t[x][y + 1] = a[x + 1][y];
t[x + 1][y + 1] = a[x + 1][y - 1];
t[x + 1][y] = a[x][y - 1];
t[x + 1][y - 1] = a[x - 1][y - 1];
t[x][y - 1] = a[x - 1][y];
} else {
t[x - 1][y - 1] = a[x + 1][y - 1];
t[x - 1][y] = a[x][y - 1];
t[x - 1][y + 1] = a[x - 1][y - 1];
t[x][y + 1] = a[x - 1][y];
t[x + 1][y + 1] = a[x - 1][y + 1];
t[x + 1][y] = a[x][y + 1];
t[x + 1][y - 1] = a[x + 1][y + 1];
t[x][y - 1] = a[x + 1][y];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) a[i][j] = t[i][j];
}
// show();
}
show();
return 0;
}