結果

問題 No.2072 Anatomy
ユーザー ああいいああいい
提出日時 2022-09-17 23:21:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 636 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 847,116 KB
最終ジャッジ日時 2023-08-23 17:55:49
合計ジャッジ時間 13,105 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,124 KB
testcase_01 AC 69 ms
71,272 KB
testcase_02 AC 70 ms
71,124 KB
testcase_03 AC 74 ms
71,268 KB
testcase_04 AC 70 ms
71,196 KB
testcase_05 AC 72 ms
71,252 KB
testcase_06 AC 70 ms
71,180 KB
testcase_07 AC 73 ms
75,056 KB
testcase_08 AC 417 ms
90,488 KB
testcase_09 AC 237 ms
101,628 KB
testcase_10 AC 387 ms
91,288 KB
testcase_11 AC 291 ms
102,112 KB
testcase_12 AC 313 ms
113,028 KB
testcase_13 AC 315 ms
92,652 KB
testcase_14 AC 338 ms
87,388 KB
testcase_15 AC 272 ms
148,428 KB
testcase_16 AC 392 ms
92,088 KB
testcase_17 AC 283 ms
118,848 KB
testcase_18 AC 229 ms
113,192 KB
testcase_19 AC 313 ms
92,104 KB
testcase_20 AC 402 ms
92,800 KB
testcase_21 MLE -
testcase_22 AC 410 ms
93,100 KB
testcase_23 MLE -
testcase_24 AC 836 ms
501,016 KB
testcase_25 AC 233 ms
90,728 KB
testcase_26 AC 70 ms
71,468 KB
testcase_27 MLE -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 8)

N,M = map(int,input().split())
edge = []
for _ in range(M):
    u,v = map(int,input().split())
    edge.append((u-1,v-1))

parent = [-1] * N
def find(i):
    if parent[i] < 0:
        return i
    parent[i] = find(parent[i])
    return parent[i]
def unite(i,j):
    I = find(i)
    J = find(j)
    if I == J:
        parent[I] -= 1
        return False
    t = min(parent[I],parent[J])
    parent[I] = J
    parent[i] = J
    parent[J] = t - 1
    return True
def isSame(i,j):
    return find(i) == find(j)

ans = 0

for u,v in reversed(edge):
    unite(u,v)
ans = min(parent)
print(-ans - 1)
0