結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー titiatitia
提出日時 2020-09-11 21:32:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 10,272 KB
最終ジャッジ日時 2023-08-27 10:53:53
合計ジャッジ時間 3,575 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,892 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 16 ms
7,944 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 82 ms
9,636 KB
testcase_05 AC 20 ms
8,304 KB
testcase_06 AC 40 ms
8,520 KB
testcase_07 AC 20 ms
8,264 KB
testcase_08 AC 27 ms
8,444 KB
testcase_09 AC 44 ms
8,872 KB
testcase_10 AC 42 ms
8,512 KB
testcase_11 AC 87 ms
9,636 KB
testcase_12 AC 55 ms
9,148 KB
testcase_13 AC 22 ms
8,320 KB
testcase_14 AC 16 ms
7,776 KB
testcase_15 AC 56 ms
8,884 KB
testcase_16 AC 57 ms
8,808 KB
testcase_17 AC 78 ms
9,480 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 40 ms
8,596 KB
testcase_25 AC 69 ms
9,372 KB
testcase_26 AC 36 ms
8,628 KB
testcase_27 AC 15 ms
7,928 KB
testcase_28 AC 69 ms
9,400 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 92 ms
9,556 KB
testcase_32 WA -
testcase_33 AC 44 ms
8,892 KB
testcase_34 AC 85 ms
9,896 KB
testcase_35 AC 104 ms
9,928 KB
testcase_36 AC 42 ms
8,920 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
                C[j]=1

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