結果
問題 | No.1605 Matrix Shape |
ユーザー | tonyu0 |
提出日時 | 2022-09-21 13:13:05 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 10,788 KB |
実行使用メモリ | 51,152 KB |
最終ジャッジ日時 | 2023-08-23 19:54:50 |
合計ジャッジ時間 | 19,593 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
11,092 KB |
testcase_01 | AC | 51 ms
11,236 KB |
testcase_02 | AC | 23 ms
11,184 KB |
testcase_03 | WA | - |
testcase_04 | AC | 23 ms
11,208 KB |
testcase_05 | AC | 48 ms
11,220 KB |
testcase_06 | WA | - |
testcase_07 | AC | 23 ms
11,172 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 24 ms
11,080 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 23 ms
11,272 KB |
testcase_19 | AC | 1,090 ms
50,996 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 1,075 ms
50,992 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 881 ms
43,364 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 979 ms
50,080 KB |
testcase_34 | WA | - |
testcase_35 | AC | 829 ms
43,068 KB |
testcase_36 | AC | 510 ms
31,068 KB |
ソースコード
n=int(input()) M=200001 par=[-1]*M def root(a): if par[a]<0: return a return root(par[a]) def same(a, b): return root(a)==root(b) def merge(a,b): if same(a,b):return a=root(a) b=root(b) if par[a]>par[b]:a,b=b,a par[a]+=par[b] par[b]=a def sz(a): return -par[root(a)] a=[list(map(lambda x:int(x)-1, input().split())) for i in range(n)] deg = [0]*M for x,y in a: merge(x,y) deg[x]-=1 deg[y]+=1 if sz(a[0][0]) == n: st=set() for i in range(M): st.add(deg[i]) if len(st) > 2: print(1) else:print(n) else: print(0)