結果

問題 No.1605 Matrix Shape
ユーザー tonyu0
提出日時 2022-09-21 12:04:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 53,120 KB
最終ジャッジ日時 2024-12-22 04:02:29
合計ジャッジ時間 20,434 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 22 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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