hiho week 156 register

Ended

Participants:264

Verdict:Accepted
Score:100 / 100
Submitted:2017-06-25 16:04:29

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 <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cstring>
using namespace std;
int n, m;
int tot = 0;
set<string> areas;
set<int> sizes;
int** map;
int** visited;
void dfs(int i, int j, string& island, int& size) {
    size++;
    visited[i][j] = 1;
    if (j+1 < m && map[i][j + 1] && !visited[i][j + 1]) {
        island.append("r");
        dfs(i, j + 1, island, size);
    }
    if(i+1 < n && map[i + 1][j] && !visited[i + 1][j]) {
        island.append("d");
        dfs(i + 1, j, island, size);
    }
    if (j > 0 && map[i][j - 1] && !visited[i][j - 1]) {
        island.append("l");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX