結果
問題 | No.2202 贅沢てりたまチキン |
ユーザー | titia |
提出日時 | 2023-02-03 23:13:43 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 10,992 KB |
実行使用メモリ | 27,264 KB |
最終ジャッジ日時 | 2023-09-15 19:29:03 |
合計ジャッジ時間 | 10,228 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,788 KB |
testcase_01 | AC | 15 ms
7,820 KB |
testcase_02 | AC | 15 ms
7,912 KB |
testcase_03 | WA | - |
testcase_04 | AC | 16 ms
7,832 KB |
testcase_05 | AC | 15 ms
7,792 KB |
testcase_06 | AC | 16 ms
7,844 KB |
testcase_07 | AC | 16 ms
7,828 KB |
testcase_08 | AC | 15 ms
7,936 KB |
testcase_09 | AC | 15 ms
7,960 KB |
testcase_10 | AC | 52 ms
27,044 KB |
testcase_11 | AC | 15 ms
7,784 KB |
testcase_12 | AC | 15 ms
7,832 KB |
testcase_13 | AC | 14 ms
7,864 KB |
testcase_14 | AC | 697 ms
27,092 KB |
testcase_15 | AC | 694 ms
27,120 KB |
testcase_16 | AC | 634 ms
27,076 KB |
testcase_17 | AC | 644 ms
27,188 KB |
testcase_18 | AC | 328 ms
17,728 KB |
testcase_19 | AC | 343 ms
27,088 KB |
testcase_20 | WA | - |
testcase_21 | AC | 632 ms
27,088 KB |
testcase_22 | AC | 353 ms
8,352 KB |
testcase_23 | AC | 427 ms
8,764 KB |
testcase_24 | AC | 402 ms
8,584 KB |
testcase_25 | AC | 942 ms
27,088 KB |
testcase_26 | WA | - |
testcase_27 | AC | 688 ms
27,092 KB |
ソースコード
import sys input = sys.stdin.readline N,M=map(int,input().split()) # UnionFind Group = [i for i in range(2*N+1)] # グループ分け Nodes = [1]*(2*N+1) # 各グループのノードの数 def find(x): while Group[x] != x: x=Group[x] return x def Union(x,y): if find(x) != find(y): if Nodes[find(x)] < Nodes[find(y)]: Nodes[find(y)] += Nodes[find(x)] Nodes[find(x)] = 0 Group[find(x)] = find(y) else: Nodes[find(x)] += Nodes[find(y)] Nodes[find(y)] = 0 Group[find(y)] = find(x) for i in range(M): a,b=map(int,input().split()) Union(a,b+N) Union(a+N,b) if Nodes[find(1)]==2*N: print("Yes") else: print("No")