hiho week 203 register

Ended

Participants:117

Verdict:Accepted
Score:100 / 100
Submitted:2018-05-25 13:29:54

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<cstdio>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
const int maxn = 505;
int h, w;
char mat[maxn][maxn];
int vis[maxn][maxn];
int mCnt = 0, sCnt = 0;
int dir[8][2] = { {-1, 0}, {0,-1}, {1, 0}, {0, 1}, {-1, -1}, {-1, 1}, {1, -1}, {1, 1} };
void bfs0(int x, int y) {
    queue<int> que;
    que.push(x * w + y);
    
    int lastU = -1, lastV = -1;
    int maxH = 0, minH = 500, maxW = 0, minW = 500;
    while (!que.empty()) {
        int u = que.front();
        lastU = u;
        que.pop();
        x = u / w;
        y = u % w;
        maxH = max(maxH, x);
        minH = min(minH, x);
        maxW = max(maxW, y);
        minW = min(minW, y);
        for (int i = 0; i < 8; ++i) {
            int newX = x + dir[i][0];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX