hiho week 232 register

Ended

Participants:110

Verdict:Accepted
Score:100 / 100
Submitted:2018-12-09 10:35:55

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<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
struct block
{
    int l,r,u,d;
};
int n,m,num;
int i,j,k;
int a[505][505],mp[505][505];
bool flag[505][505];
block b[300010];
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
void dfs(int x,int y)
{
    b[num].l=min(b[num].l,y);
    b[num].r=max(b[num].r,y);
    b[num].u=min(b[num].u,x);
    b[num].d=max(b[num].d,x);
    flag[x][y]=1; mp[x][y]=num;
    for (int i=0;i<4;i++)
    {
        if (a[x+dx[i]][y+dy[i]]&&!flag[x+dx[i]][y+dy[i]])
        {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX