結果

問題 No.1605 Matrix Shape
ユーザー H3PO4H3PO4
提出日時 2021-07-16 21:40:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 357 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 27,340 KB
最終ジャッジ日時 2023-09-20 13:23:43
合計ジャッジ時間 15,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
9,880 KB
testcase_01 AC 35 ms
9,880 KB
testcase_02 AC 34 ms
9,908 KB
testcase_03 AC 34 ms
9,788 KB
testcase_04 WA -
testcase_05 AC 34 ms
9,784 KB
testcase_06 AC 34 ms
9,744 KB
testcase_07 AC 33 ms
9,844 KB
testcase_08 AC 35 ms
9,884 KB
testcase_09 AC 33 ms
9,888 KB
testcase_10 AC 34 ms
9,804 KB
testcase_11 AC 34 ms
9,896 KB
testcase_12 AC 34 ms
9,896 KB
testcase_13 AC 34 ms
9,860 KB
testcase_14 AC 33 ms
9,840 KB
testcase_15 AC 34 ms
9,860 KB
testcase_16 AC 34 ms
9,868 KB
testcase_17 AC 34 ms
9,864 KB
testcase_18 AC 34 ms
9,928 KB
testcase_19 AC 792 ms
27,220 KB
testcase_20 AC 763 ms
18,444 KB
testcase_21 AC 760 ms
18,536 KB
testcase_22 WA -
testcase_23 AC 793 ms
27,340 KB
testcase_24 AC 791 ms
27,196 KB
testcase_25 AC 650 ms
10,112 KB
testcase_26 AC 665 ms
10,160 KB
testcase_27 AC 658 ms
10,028 KB
testcase_28 WA -
testcase_29 AC 648 ms
10,148 KB
testcase_30 AC 775 ms
18,568 KB
testcase_31 AC 750 ms
18,592 KB
testcase_32 AC 701 ms
13,660 KB
testcase_33 WA -
testcase_34 AC 631 ms
9,904 KB
testcase_35 AC 606 ms
27,232 KB
testcase_36 AC 381 ms
18,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N = int(input())
MAX = 2 * 10 ** 5
deg = [0] * MAX
st = set()
for _ in range(N):
    H, W = (int(x) - 1 for x in input().split())
    deg[H] += 1
    deg[W] -= 1
    st.add(H)
    st.add(W)

ct = Counter(deg)
if ct[0] == MAX:
    print(len(st))
elif ct[0] == MAX - 2 and ct[-1] == ct[1] == 1:
    print(1)
else:
    print(0)
0