結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー titiatitia
提出日時 2020-09-11 21:36:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 9,944 KB
最終ジャッジ日時 2023-08-27 12:01:30
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 16 ms
7,984 KB
testcase_02 AC 16 ms
8,012 KB
testcase_03 AC 17 ms
7,988 KB
testcase_04 AC 96 ms
9,488 KB
testcase_05 AC 21 ms
8,112 KB
testcase_06 AC 40 ms
8,436 KB
testcase_07 AC 21 ms
7,988 KB
testcase_08 AC 31 ms
8,304 KB
testcase_09 AC 47 ms
8,736 KB
testcase_10 AC 45 ms
8,692 KB
testcase_11 AC 107 ms
9,760 KB
testcase_12 AC 58 ms
8,884 KB
testcase_13 AC 23 ms
8,016 KB
testcase_14 AC 17 ms
7,996 KB
testcase_15 AC 58 ms
9,040 KB
testcase_16 AC 57 ms
8,956 KB
testcase_17 AC 85 ms
9,304 KB
testcase_18 AC 105 ms
9,944 KB
testcase_19 AC 44 ms
8,644 KB
testcase_20 AC 33 ms
8,508 KB
testcase_21 AC 61 ms
9,040 KB
testcase_22 AC 44 ms
8,688 KB
testcase_23 AC 48 ms
8,740 KB
testcase_24 AC 41 ms
8,668 KB
testcase_25 AC 72 ms
9,380 KB
testcase_26 AC 38 ms
8,512 KB
testcase_27 AC 16 ms
8,016 KB
testcase_28 AC 74 ms
9,264 KB
testcase_29 AC 46 ms
8,748 KB
testcase_30 AC 65 ms
8,932 KB
testcase_31 AC 92 ms
9,484 KB
testcase_32 AC 101 ms
9,680 KB
testcase_33 AC 46 ms
8,692 KB
testcase_34 AC 94 ms
9,912 KB
testcase_35 AC 106 ms
9,828 KB
testcase_36 AC 44 ms
8,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

ANS=[[-1]*N for i in range(N)]

for i in range(N):
    if S[i]==0:
        for j in range(N):
            ANS[i][j]=0
    elif S[i]==2:
        for j in range(N):
            ANS[i][j]=1

    if T[i]==0:
        for j in range(N):
            ANS[j][i]=0
    elif T[i]==2:
        for j in range(N):
            ANS[j][i]=1

score=0
R=[0]*N
C=[0]*N

for i in range(N):
    for j in range(N):
        if ANS[i][j]==1:
            score+=1
            R[i]=-1
            C[j]=-1

        elif ANS[i][j]==-1:
            if R[i]!=-1:
                R[i]=1
            if C[j]!=-1:
                C[j]=1

print(score+max(R.count(1),C.count(1)))
0