hihoCoder太阁最新面经算法竞赛10 register

Ended

Participants:138

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-30 02:36:28

Lang:Java

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
import java.util.Scanner;
/**
 * Created by hwang on 29.07.16.
 */
public class Main {
    static int[] father = null;
    static int Find_Set(int x) {
        if (x != father[x]) {
            father[x= Find_Set(father[x]);
        }
        return father[x];
    }
    static int emb(int xint y) {
        if (x < 0 || x >= 1000)
            return -1;
        if (y < 0 || y >= 1000)
            return -1;
        return x*1000+y;
    }
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int[] xChange = {1,0,-1,0};
        int[] yChange = {0,1,0,-1};
        int N = 1000*1000*2;
        father = new int[N];
        boolean[] flag = new boolean[N];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX