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

Ended

Participants:100

Verdict:Wrong Answer
Score:0 / 100
Submitted:2016-07-06 01:09:25

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.*;
class UnionFind {
    HashMap<StringString> father = new HashMap<StringString>();
    String find(String x){
        String parent =  father.get(x);
        while (parent != father.get(parent)) {
            parent = father.get(parent);
        }
        return parent;
    }
    void union(String xString y){
        String fa_x = find(x);
        String fa_y = find(y);
        if (fa_x != fa_y) {
            father.put(fa_xfa_y);
        }
    }
}
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        HashMap<StringString> map = new HashMap<StringString>();
        HashMap<StringArrayList<String>> usermap = new HashMap<StringArrayList<String>>();
        UnionFind uf = new UnionFind();
        ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
        for (int times = 0times < ntimes++) {
            String username = in.next();
            uf.father.put(usernameusername);
            int num = Integer.valueOf(in.next());
            for (int i = 0i < numi++) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX