結果

問題 No.1225 I hate I hate Matrix Construction
コンテスト
ユーザー yansi819
提出日時 2024-05-06 10:12:38
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 336 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 201 ms
コンパイル使用メモリ 85,072 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2026-05-22 16:14:58
合計ジャッジ時間 2,775 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

s1 = S.count(1)
s2 = S.count(2)
t1 = T.count(1)
t2 = T.count(2)

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