結果

問題 No.2072 Anatomy
ユーザー ああいいああいい
提出日時 2022-09-17 23:19:53
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 618 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 842,080 KB
最終ジャッジ日時 2023-08-23 17:55:35
合計ジャッジ時間 14,723 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,292 KB
testcase_01 AC 70 ms
71,260 KB
testcase_02 AC 72 ms
71,248 KB
testcase_03 AC 71 ms
71,384 KB
testcase_04 AC 69 ms
71,308 KB
testcase_05 AC 70 ms
71,388 KB
testcase_06 AC 71 ms
71,264 KB
testcase_07 AC 78 ms
74,944 KB
testcase_08 AC 453 ms
90,804 KB
testcase_09 AC 259 ms
113,684 KB
testcase_10 AC 418 ms
92,140 KB
testcase_11 AC 304 ms
101,956 KB
testcase_12 AC 321 ms
113,336 KB
testcase_13 AC 334 ms
91,532 KB
testcase_14 AC 358 ms
87,604 KB
testcase_15 AC 289 ms
148,268 KB
testcase_16 AC 451 ms
93,956 KB
testcase_17 AC 297 ms
118,648 KB
testcase_18 AC 249 ms
112,964 KB
testcase_19 AC 338 ms
92,052 KB
testcase_20 AC 404 ms
92,844 KB
testcase_21 MLE -
testcase_22 AC 800 ms
92,316 KB
testcase_23 MLE -
testcase_24 AC 861 ms
501,564 KB
testcase_25 AC 276 ms
90,868 KB
testcase_26 AC 70 ms
71,288 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[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