답안 #14666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14666 2015-05-30T08:06:21 Z gs14004 게임 (IOI14_game) C++14
0 / 100
0 ms 9884 KB
int pa[1505];
int cnt[1505];
int m;

int find(int x){
    return pa[x] = (pa[x] == x ? x : find(pa[x]));
}

void initialize(int n){
    m = n;
    for(int i=0; i<=n; i++) pa[i] = i;
}

int hasEdge(int u, int v){
    cnt[u]++;
    cnt[v]++;
    if(cnt[u] == m-1 || cnt[v] == m-1){
        if(find(u) != find(v)){
            pa[u] = v;
            return 0;
        }
        return 1;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 9884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 9884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 9884 KB Output isn't correct
2 Halted 0 ms 0 KB -