結果

問題 No.1605 Matrix Shape
ユーザー tonyu0tonyu0
提出日時 2022-09-21 12:04:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 50,660 KB
最終ジャッジ日時 2023-08-23 19:54:21
合計ジャッジ時間 16,199 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 97 ms
11,072 KB
testcase_02 AC 69 ms
11,184 KB
testcase_03 AC 99 ms
11,144 KB
testcase_04 WA -
testcase_05 AC 97 ms
11,216 KB
testcase_06 AC 101 ms
11,092 KB
testcase_07 AC 68 ms
11,092 KB
testcase_08 AC 99 ms
11,084 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 68 ms
11,124 KB
testcase_12 AC 98 ms
11,096 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 69 ms
11,156 KB
testcase_16 AC 73 ms
11,156 KB
testcase_17 AC 69 ms
11,240 KB
testcase_18 AC 71 ms
11,144 KB
testcase_19 AC 759 ms
50,480 KB
testcase_20 AC 720 ms
50,400 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 775 ms
50,448 KB
testcase_24 WA -
testcase_25 AC 705 ms
43,088 KB
testcase_26 AC 711 ms
43,196 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 746 ms
50,536 KB
testcase_31 WA -
testcase_32 AC 729 ms
50,064 KB
testcase_33 AC 682 ms
50,008 KB
testcase_34 AC 701 ms
49,224 KB
testcase_35 AC 578 ms
42,532 KB
testcase_36 AC 380 ms
30,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=[list(map(int, input().split())) for i in range(n)]

M=200001
X=[0]*M
Y=[0]*M
for x, y in a:
    X[x]+=1
    Y[y]+=1
c=0
for i in range(M):
    c+=abs(X[i]-Y[i])
if c==0:
    ans=0
    for i in range(M):
        if X[i]>0 or Y[i]>0:
            ans+=1
    print(ans)
elif c==1:
    print(1)
else:
    print(0)
0