結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 👑 Kazun
提出日時 2020-09-11 22:11:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-12-27 14:50:21
合計ジャッジ時間 2,721 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=list(map(int,input().split()))
T=list(map(int,input().split()))

X=[S.count(i) for i in range(N)]
Y=[T.count(j) for j in range(N)]


if X[2]==Y[2]==0:
    print(max(X[1],Y[1]))
elif X[2]*Y[2]!=0:
    print((N-X[0])*(N-Y[0])-X[1]*Y[1])
elif X[2]==0 and Y[2]!=0:
    print(N*Y[2]+Y[1])
else:
    print(N*X[2]+X[1])
0