Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<iostream>#include<cstring>#include<queue>using namespace std;int n, m;int a[802][802];bool vis[802][802];int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};bool inmap(int x, int y) {if(x < 1 || x > n || y < 1 || y > m)return 0;return 1;}int main() {cin >> n >> m;cin.get();char p;memset(vis, 0, sizeof(vis));queue<pair<int, int> > q;for(int i = 1; i <= n; ++i) {for(int j = 1; j <= m; ++j) {cin >> p;if(p == '0') {a[i][j] = 0;q.push(make_pair(i, j));vis[i][j] = 1;}}cin.get();}