結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 8wings64
提出日時 2020-09-11 22:31:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 1,626 ms
コンパイル使用メモリ 81,152 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-12-27 16:06:23
合計ジャッジ時間 3,942 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
ans_s = 0
ans_t = 0
for i in S:
    if i == 1:
        ans_s+=1
    elif i == 2:
        ans_s += N
for j in T:
    if j == 1:
        ans_t+=1
    elif j == 2:
        ans_t += N
x = S.count(2)
y = T.count(2)
ans_max =0
if x == 0 or y == 0:
    ans_max = 0
else:
    ans_max = max(x,y)*N+(N-max(x,y))*min(x,y)
print(max(ans_s,ans_t,ans_max))
0