結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー neterukunneterukun
提出日時 2020-09-11 22:12:28
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 733 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 76,152 KB
最終ジャッジ日時 2023-08-27 14:55:09
合計ジャッジ時間 4,709 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,108 KB
testcase_01 AC 65 ms
70,892 KB
testcase_02 AC 68 ms
70,756 KB
testcase_03 AC 76 ms
75,340 KB
testcase_04 AC 74 ms
75,580 KB
testcase_05 AC 71 ms
75,436 KB
testcase_06 AC 75 ms
75,924 KB
testcase_07 AC 71 ms
75,444 KB
testcase_08 AC 71 ms
75,404 KB
testcase_09 AC 75 ms
76,072 KB
testcase_10 AC 72 ms
75,772 KB
testcase_11 AC 70 ms
75,812 KB
testcase_12 AC 73 ms
75,804 KB
testcase_13 AC 76 ms
75,316 KB
testcase_14 AC 74 ms
75,420 KB
testcase_15 AC 76 ms
75,872 KB
testcase_16 AC 76 ms
75,756 KB
testcase_17 AC 73 ms
75,840 KB
testcase_18 AC 81 ms
75,836 KB
testcase_19 AC 74 ms
75,948 KB
testcase_20 AC 73 ms
75,660 KB
testcase_21 AC 75 ms
75,808 KB
testcase_22 AC 74 ms
75,788 KB
testcase_23 AC 76 ms
75,920 KB
testcase_24 AC 74 ms
75,584 KB
testcase_25 AC 74 ms
75,664 KB
testcase_26 AC 74 ms
75,832 KB
testcase_27 AC 67 ms
71,084 KB
testcase_28 AC 77 ms
75,840 KB
testcase_29 AC 74 ms
75,812 KB
testcase_30 AC 75 ms
76,136 KB
testcase_31 AC 77 ms
75,880 KB
testcase_32 AC 78 ms
76,152 KB
testcase_33 AC 75 ms
75,812 KB
testcase_34 AC 78 ms
75,936 KB
testcase_35 AC 81 ms
76,012 KB
testcase_36 AC 74 ms
75,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(map(int, input().split()))
t = list(map(int, input().split()))


a = [[-1] * n for i in range(n)]
for i in range(n):
    if s[i] == 0:
        for j in range(n):
            a[i][j] = 0
    if s[i] == 2:
        for j in range(n):
            a[i][j] = 1
    if t[i] == 0:
        for j in range(n):
            a[j][i] = 0
    if t[i] == 2:
        for j in range(n):
            a[j][i] = 1

cnt1 = 0
for i in range(n):
    for j in range(n):
        if a[i][j] == 1:
            cnt1 += 1

if 2 in s and 2 in t:
    print(cnt1)
elif 0 in s and 0 in t:
    print(max(s.count(1), t.count(1)))
elif 2 in s or 2 in t:
    print(cnt1 + min(s.count(1), t.count(1)))
else:
    print(max(s.count(1), t.count(1)))
0