結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー roaris
提出日時 2021-07-27 01:14:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-07-22 17:03:01
合計ジャッジ時間 2,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
s0, s1, s2 = S.count(0), S.count(1), S.count(2)
t0, t1, t2 = T.count(0), T.count(1), T.count(2)

if 2 in S:
    if 0 in S:
        print(s2*N+s1)
    else:
        if 2 in T:
            print((s2+t2)*N-s2*t2)
        else:
            print(s2*N+s1)
elif 2 in T:
    if 0 in T:
        print(t2*N+t1)
    else:
        if 2 in S:
            print((s2+t2)*N-s2*t2)
        else:
            print(t2*N+t1)
else:
    print(max(s1, t1))
0