#include <bits/stdc++.h>
using namespace std;
int land[1010][1010] = {}, n, m;
int ans = 0, ansx[1010 * 1010] = {}, ansy[1010 * 1010] = {};
/* 为啥上面这两行放在main函数里就运行不了,光标闪一下就请按任意键继续了, vscode, windows-gcc-x64, C/C++ Compile Run v1.0.28 */
/* 但是luogu我交上去都AC诶 */
int main(){
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i){
for (int j = 1; j <= m; ++j){
scanf("%d", &land[i][j]);
}
}
int t, xa, ya, xb, yb;
scanf("%d", &t);
while (t--){
scanf("%d%d%d%d", &xa, &ya, &xb, &yb);
swap(land[xa][ya], land[xb][yb]);
}
for (int i = 1; i <= n; ++i){
for (int j = 1; j <= m; ++j){
if (land[i][j] > land[i - 1][j] && land[i][j] > land[i + 1][j] && land[i][j] > land[i][j - 1] && land[i][j] > land[i][j + 1]){
++ans;
ansx[ans] = i;
ansy[ans] = j;
/* 坐标先存着 */
}
}
}
printf("%d\n", ans);
for (int i = 1; i <= ans; ++i){
printf("%d %d\n", ansx[i], ansy[i]);
}
return 0;
}
如注释,我的环境:vscode, windows-gcc-x64。 装的扩展:C/C++ v1.13.9,C/C++ Compile Run v1.0.28,CodeLLDB v1.8.1 还有简中扩展包
下面两行我放在main函数里用C/C++ Compile Run运行,光标闪一下就“请按任意键继续”了;用vscode自己的“运行C/C++程序”就出来“找不到cygwin.S”这个文件,也没法跑
但是代码交到洛谷上是AC,请问问题出在哪qwq
int land[1010][1010] = {}, n, m;
int ans = 0, ansx[1010 * 1010] = {}, ansy[1010 * 1010] = {};