結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 👑 rin204rin204
提出日時 2022-01-18 21:54:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 819 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 76,360 KB
最終ジャッジ日時 2023-08-15 07:40:16
合計ジャッジ時間 5,183 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,016 KB
testcase_01 AC 66 ms
70,732 KB
testcase_02 AC 64 ms
70,996 KB
testcase_03 AC 69 ms
75,260 KB
testcase_04 AC 84 ms
76,196 KB
testcase_05 AC 77 ms
75,348 KB
testcase_06 AC 77 ms
75,780 KB
testcase_07 AC 75 ms
75,344 KB
testcase_08 AC 74 ms
75,472 KB
testcase_09 AC 81 ms
75,888 KB
testcase_10 AC 80 ms
76,192 KB
testcase_11 AC 77 ms
76,344 KB
testcase_12 AC 75 ms
76,052 KB
testcase_13 AC 71 ms
75,328 KB
testcase_14 AC 69 ms
75,416 KB
testcase_15 AC 75 ms
76,328 KB
testcase_16 AC 75 ms
76,124 KB
testcase_17 AC 76 ms
76,092 KB
testcase_18 AC 82 ms
76,048 KB
testcase_19 AC 77 ms
76,160 KB
testcase_20 AC 78 ms
75,964 KB
testcase_21 AC 76 ms
75,704 KB
testcase_22 AC 73 ms
75,696 KB
testcase_23 AC 76 ms
75,756 KB
testcase_24 AC 73 ms
76,088 KB
testcase_25 AC 73 ms
76,208 KB
testcase_26 AC 73 ms
76,040 KB
testcase_27 AC 65 ms
71,096 KB
testcase_28 AC 74 ms
76,100 KB
testcase_29 AC 78 ms
75,876 KB
testcase_30 AC 76 ms
75,864 KB
testcase_31 AC 80 ms
76,360 KB
testcase_32 AC 79 ms
76,124 KB
testcase_33 AC 72 ms
76,100 KB
testcase_34 AC 74 ms
76,072 KB
testcase_35 AC 76 ms
75,988 KB
testcase_36 AC 73 ms
75,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))

A = [[0] * n for _ in range(n)]
for i in range(n):
    if S[i] == 2:
        for j in range(n):
            A[i][j] = 1
            
for j in range(n):
    if T[j] == 2:
        for i in range(n):
            A[i][j] = 1
            
c1 = 0
for i in range(n):
    if S[i] == 1:
        ok = False
        for j in range(n):
            if A[i][j] == 1:
                ok = True
                break
        if not ok:
            c1 += 1
            
c2 = 0
for j in range(n):
    if T[j] == 1:
        ok = False
        for i in range(n):
            if A[i][j] == 1:
                ok = True
                break
        if not ok:
            c2 += 1
            
ans = sum(sum(row) for row in A) + max(c1, c2)
print(ans)
0