Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<cstdio>int ans;int Matrix[101][101];bool visited[101][101];void search(int start_x, int start_y, int N, int M) {int horizontal[4] = {-1, 1, 0, 0};int vertical[4] = {0, 0, 1, -1};int bias = 4;for (int i = 0; i < 4; i++) {int next_x = start_x + horizontal[i];int next_y = start_y + vertical[i];if ((next_x >= 0) && (next_x < N) && (next_y >= 0) && (next_y < M)) {if (Matrix[next_x][next_y] == Matrix[start_x][start_y]) {bias--;}if ((!visited[next_x][next_y]) && (Matrix[next_x][next_y] == Matrix[start_x][start_y])) {visited[next_x][next_y] = true;search(next_x, next_y, N, M);}}}ans += bias;}int main() {int N, M, x, y;scanf("%d %d %d %d", &N, &M, &x, &y);for (int i = 0; i < N; i++) {