hiho week 253 register

Ended

Participants:61

Verdict:Accepted
Score:100 / 100
Submitted:2019-05-08 17:33:00

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<bits/stdc++.h>
using namespace std;
int get_father(int x, vector<int> &fa) {
    return fa[x] == x ? x : (fa[x] = get_father(fa[x], fa));
}
void un(int x, int y, vector<int> &fa) {
    //printf("x = %d y = %d\n", x, y);
    int fx = get_father(x, fa), fy = get_father(y, fa);
    if(fx != fy) {
        fa[fx] = fy;
    }
}
int main() {
    //freopen("in.txt", "r", stdin);
    int n, m;
    while(~scanf("%d%d", &n, &m)) {
        vector<vector<int> >w(n, vector<int>(m));
        for(int i = 0; i < n; i++) {
            char ch;
            scanf("%c", &ch);
            for(int j = 0; j < m; j++) {
                scanf("%c", &ch);
                if(ch == '\\') {
                    w[i][j] = 1;
                }
                else if(ch == '/') {
                    w[i][j] = 2;
                }
                else {
                    w[i][j] = 0;
                }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX