hiho week 236 register

Ended

Participants:103

Verdict:Accepted
Score:100 / 100
Submitted:2019-01-07 18:24:08

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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();
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX