結果
| 問題 | No.1225 I hate I hate Matrix Construction | 
| コンテスト | |
| ユーザー | 👑  SPD_9X2 | 
| 提出日時 | 2020-09-11 21:41:51 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 57 ms / 2,000 ms | 
| コード長 | 1,271 bytes | 
| コンパイル時間 | 399 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 54,272 KB | 
| 最終ジャッジ日時 | 2024-12-27 08:58:54 | 
| 合計ジャッジ時間 | 3,880 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 35 | 
ソースコード
"""
論理積が0が抜けてる
→1つ以上0
論理和0→全部0
論理和1→1つ1
論理積1→全部1
全0を含んでいる場合、
全1を含んでいる場合
"""
N = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
a = [[None] * N for i in range(N)]
if 0 in S and 2 in S:
    ans = 0
    for i in S:
        if i == 1:
            ans += 1
        elif i == 2:
            ans += N
    print (ans)
elif 0 in T and 2 in T:
    ans = 0
    for i in T:
        if i == 1:
            ans += 1
        elif i == 2:
            ans += N
    print (ans)
elif 0 in S or 0 in T:
    tx = 0
    ty = 0
    for i in S:
        if i == 1:
            tx += 1
    for i in T:
        if i == 1:
            ty += 1
    print (max(tx,ty))
elif 2 in S and 2 in T:
    tx = 0
    ty = 0
    for i in S:
        if i == 2:
            tx += 1
    for i in T:
        if i == 2:
            ty += 1
    print (tx * N + ty * N - tx * ty)
elif 2 in S:
    ans = 0
    for i in S:
        if i == 1:
            ans += 1
        else:
            ans += N
    print (ans)
elif 2 in T:
    ans = 0
    for i in T:
        if i == 1:
            ans += 1
        else:
            ans += N
    print (ans)
else:
    print (N)
            
            
            
        