hiho week 178 register

Ended

Participants:294

Verdict:Accepted
Score:100 / 100
Submitted:2017-11-28 22:32:12

Lang:C#

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
using System;
using System.Text;
public class Hello{
    static int n;
    static int[][] mentors;
    static int[] sd;
    static int getSD(int i){
        if(sd[i] == 0){
            return i;
        }
        if(sd[i]>0){
            return sd[i];
        }
        int[] a=mentors[i];
        int f = getSD(a[0]);
        if(a.Length==1){
            sd[i] = f;
            return f;
        }
        for(int j=1;j!=a.Length;++j){
            int n = getSD(a[j]);
            if(f!=n){
                sd[i] = 0;
                return i;
            }
        }
        sd[i] = f;
        return f;
    }
    static void Main(){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX