結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー ayaoni
提出日時 2020-10-17 10:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-07-21 01:55:42
合計ジャッジ時間 2,976 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N = I()
S = LI()
T = LI()

s0,s1,s2 = 0,0,0
t0,t1,t2 = 0,0,0
for s in S:
    if s == 0:
        s0 += 1
    elif s == 1:
        s1 += 1
    else:
        s2 += 1
for t in T:
    if t == 0:
        t0 += 1
    elif t == 1:
        t1 += 1
    else:
        t2 += 1

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