hiho week 156 register

Ended

Participants:264

Verdict:Accepted
Score:100 / 100
Submitted:2017-06-29 00:21:37

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 <cstdio>
#include <vector>
#include <queue>
#include <set>
using namespace std;
struct rec{
    int x, y, id;
    rec(){}
    rec(int X, int Y, int i):x(X), y(Y), id(i){}
};
int n, m; char M[55][55];
bool v[55][55]; int P;
set<unsigned long> A; set<vector<int> > S;
queue<rec> Q;
void bfs(int x, int y){
    Q.push(rec(x, y, 1)); v[x][y]=1;
    rec w; vector<int> t; int cnt=1;
    while(!Q.empty()){
        w=Q.front(); Q.pop();
        if(!v[w.x-1][w.y]&&M[w.x-1][w.y]=='#') t.push_back(0), t.push_back(w.id), Q.push(rec(w.x-1, w.y, ++cnt)), v[w.x-1][w.y]=1;
        if(!v[w.x+1][w.y]&&M[w.x+1][w.y]=='#') t.push_back(1), t.push_back(w.id), Q.push(rec(w.x+1, w.y, ++cnt)), v[w.x+1][w.y]=1;
        if(!v[w.x][w.y-1]&&M[w.x][w.y-1]=='#') t.push_back(2), t.push_back(w.id), Q.push(rec(w.x, w.y-1, ++cnt)), v[w.x][w.y-1]=1;
        if(!v[w.x][w.y+1]&&M[w.x][w.y+1]=='#') t.push_back(3), t.push_back(w.id), Q.push(rec(w.x, w.y+1, ++cnt)), v[w.x][w.y+1]=1;
    }
    A.insert(t.size()); S.insert(t);
}
int main(){
    scanf("%d%d", &n, &m);
    for(int i=1;i<=n;i++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX