답안 #628003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
628003 2022-08-13T03:05:06 Z Seb 게임 (IOI14_game) C++17
0 / 100
1 ms 212 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll p[1505],sz[1505];

ll lider(ll a) {
    if (p[a]==a) return a;
    p[a] = lider(p[a]);
    return p[a];
}

void unir(ll a, ll b) {
    if (sz[b]>sz[a]) swap(a,b);
    p[b] = a;
    sz[a] += sz[b];
    return;
}

void initialize(int n) {
    ll i;
    for (i=0;i<n;i++) {
        p[i] = i;
        sz[i] = 1;
    }
    return;
}

int hasEdge(int u, int v) {
    if (lider(u)==lider(v)) return 0;
    else {
        unir(u,v);
        return 1;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -