結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー Meso Meso
提出日時 2025-03-06 20:25:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-03-06 20:26:00
合計ジャッジ時間 3,214 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(map(int, input().split()))
t = list(map(int, input().split()))

s1 = s.count(1)
t1 = t.count(1)
s2 = s.count(2)
t2 = t.count(2)

if s2 == 0 and t2 == 0:
    print(max(s1, t1))
elif s2 > 0 and t2 > 0:
    print((s2 + t2) * n - s2 * t2)
elif s2 == 0:
    print(t1 + t2 * n)
elif t2 == 0:
    print(s1 + s2 * n)
0