gridaxitsol

 avatar
quoc14
c_cpp
5 months ago
1.4 kB
2
Indexable
caidat
#include <iostream>

using namespace std;

int n, m, sr, sc, count1, count2;

int a[3005][3005];

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int visit[3005][3005];
bool inside(int x, int y) {
	if (x >= 1 && x <= n && y >= 1 && y <= m) {
		return true;
	}
	return false;
}

bool check(int x_c, int y_c) {
	int xc_next, yc_next;
	for (int i = 0; i < 4; i++) {
		xc_next = x_c + dx[i];
		yc_next = y_c + dy[i];
		if (visit[xc_next][yc_next] == 0) {
			return false;
		}
	}
	return true;
}

int queueX[1000000], queueY[1000000];
int start, last, x_cur, y_cur, x_next, y_next;

void bfs() {
	for (int i = 0; i < 3005; i++) {
		for (int j = 0; j < 3005; j++) {
			visit[i][j] = 0;
		}
	}
	start = 0;
	last = 0;
	queueX[last] = sr;
	queueY[last++] = sc;
	visit[sr][sc] = 1;
	while (start != last) {
		x_cur = queueX[start];
		y_cur = queueY[start++];
		
		for (int i = 0; i < 4; i++) {
			x_next = x_cur + dx[i];
			y_next = y_cur + dy[i];
			if (inside(x_next, y_next)) {
				if (a[x_next][y_next] == 1) {
					
				}
			}
		}
		
	}
}

void solve(int testcase) {
	cin >> n >> m;
	cin >> sr >> sc;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> a[i][j];
		}		
	}

	
	
}

int main() {
	freopen("Text.txt", "r", stdin);
	int t; cin >> t;
	
	for (int i = 1; i <= t; i++) {
		solve(i);
	}
	
}
Leave a Comment