結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-09-11 21:38:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 71,740 KB
最終ジャッジ日時 2023-08-27 12:23:27
合計ジャッジ時間 4,684 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,464 KB
testcase_01 AC 75 ms
71,304 KB
testcase_02 AC 70 ms
71,480 KB
testcase_03 AC 72 ms
71,560 KB
testcase_04 AC 71 ms
71,188 KB
testcase_05 AC 69 ms
71,336 KB
testcase_06 AC 71 ms
71,348 KB
testcase_07 AC 69 ms
71,380 KB
testcase_08 AC 70 ms
71,192 KB
testcase_09 AC 71 ms
71,520 KB
testcase_10 AC 71 ms
71,328 KB
testcase_11 AC 72 ms
71,188 KB
testcase_12 AC 71 ms
71,380 KB
testcase_13 AC 71 ms
71,460 KB
testcase_14 AC 71 ms
71,556 KB
testcase_15 AC 70 ms
71,176 KB
testcase_16 AC 72 ms
71,456 KB
testcase_17 AC 71 ms
71,520 KB
testcase_18 AC 72 ms
71,188 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 71 ms
71,392 KB
testcase_22 AC 71 ms
71,236 KB
testcase_23 WA -
testcase_24 AC 71 ms
71,276 KB
testcase_25 AC 71 ms
71,388 KB
testcase_26 AC 70 ms
71,232 KB
testcase_27 AC 70 ms
71,340 KB
testcase_28 AC 72 ms
71,268 KB
testcase_29 WA -
testcase_30 AC 72 ms
71,268 KB
testcase_31 WA -
testcase_32 AC 70 ms
71,500 KB
testcase_33 WA -
testcase_34 AC 71 ms
71,444 KB
testcase_35 AC 71 ms
71,512 KB
testcase_36 AC 70 ms
71,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

論理積が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 or 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)

else:
    print (N)
0