1 solutions
-
0
#include <iostream> using namespace std; const int MAXN = 1e3 + 5; int n,m; int a[MAXN][MAXN]; int T; int x1,y1,x2,y2; bool check(int x,int y){ if (a[x][y] <= a[x-1][y ]) return 0; if (a[x][y] <= a[x+1][y ]) return 0; if (a[x][y] <= a[x ][y-1]) return 0; if (a[x][y] <= a[x ][y+1]) return 0; return 1; } int main(){ cin >> n >> m; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) cin >> a[i][j]; cin >> T; while (T--){ cin >> x1 >> y1 >> x2 >> y2; swap(a[x1][y1], a[x2][y2]); } int ans = 0; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (check(i,j)) ans++; cout << ans << endl; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (check(i,j)) cout << i << " " << j << endl; }
- 1
Information
- ID
- 7779
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 1
- Tags
- # Submissions
- 72
- Accepted
- 24
- Uploaded By