結果

問題 No.1605 Matrix Shape
ユーザー ああいいああいい
提出日時 2021-12-28 19:32:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-04-10 11:50:43
合計ジャッジ時間 16,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
13,696 KB
testcase_01 AC 111 ms
13,696 KB
testcase_02 AC 88 ms
13,696 KB
testcase_03 AC 101 ms
13,824 KB
testcase_04 WA -
testcase_05 AC 100 ms
13,696 KB
testcase_06 AC 105 ms
13,696 KB
testcase_07 AC 87 ms
13,696 KB
testcase_08 AC 99 ms
13,824 KB
testcase_09 AC 89 ms
13,696 KB
testcase_10 AC 86 ms
13,824 KB
testcase_11 AC 89 ms
13,952 KB
testcase_12 AC 107 ms
13,696 KB
testcase_13 AC 91 ms
13,824 KB
testcase_14 AC 85 ms
13,824 KB
testcase_15 AC 87 ms
13,696 KB
testcase_16 AC 86 ms
13,824 KB
testcase_17 AC 86 ms
13,824 KB
testcase_18 AC 87 ms
13,696 KB
testcase_19 AC 794 ms
13,696 KB
testcase_20 AC 762 ms
13,824 KB
testcase_21 AC 729 ms
13,696 KB
testcase_22 WA -
testcase_23 AC 770 ms
13,696 KB
testcase_24 AC 752 ms
13,696 KB
testcase_25 AC 739 ms
13,952 KB
testcase_26 AC 740 ms
13,824 KB
testcase_27 AC 733 ms
13,824 KB
testcase_28 WA -
testcase_29 AC 733 ms
13,824 KB
testcase_30 AC 754 ms
13,696 KB
testcase_31 AC 746 ms
13,696 KB
testcase_32 AC 750 ms
13,696 KB
testcase_33 WA -
testcase_34 AC 727 ms
13,696 KB
testcase_35 AC 628 ms
13,696 KB
testcase_36 AC 411 ms
13,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

C = 2 * (10 ** 5 ) + 1
hidari = [0] * C
migi = [0] * C
for _ in range(N):
    h,w = map(int,input().split())
    hidari[h] += 1
    migi[w] += 1
import sys
hidaricount = 0
migicount = 0
for i in range(1,C):
    if hidari[i] > migi[i]:
        hidaricount += hidari[i] - migi[i]
        ih = i
    elif hidari[i] < migi[i]:
        migicount += migi[i] - hidari[i]
        im = i
if hidaricount > 1 or migicount > 1:
    print(0)
    exit()
if hidaricount == 1:
    if ih == im:
        print(0)
        exit()
    print(1)
    exit()
ans = 0
for i in hidari:
    if i != 0:
        ans += 1
print(ans)
        
0