結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー googol_S0googol_S0
提出日時 2020-09-11 21:27:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 76,660 KB
最終ジャッジ日時 2023-08-27 09:55:15
合計ジャッジ時間 5,036 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,568 KB
testcase_01 AC 75 ms
71,308 KB
testcase_02 AC 74 ms
71,504 KB
testcase_03 AC 79 ms
75,944 KB
testcase_04 AC 92 ms
76,448 KB
testcase_05 AC 82 ms
75,964 KB
testcase_06 AC 87 ms
76,092 KB
testcase_07 AC 84 ms
75,940 KB
testcase_08 AC 85 ms
75,944 KB
testcase_09 AC 88 ms
76,064 KB
testcase_10 AC 85 ms
76,296 KB
testcase_11 AC 90 ms
76,508 KB
testcase_12 AC 89 ms
76,108 KB
testcase_13 AC 82 ms
75,896 KB
testcase_14 AC 83 ms
75,788 KB
testcase_15 AC 84 ms
76,524 KB
testcase_16 AC 84 ms
76,136 KB
testcase_17 AC 85 ms
76,660 KB
testcase_18 AC 93 ms
76,408 KB
testcase_19 AC 83 ms
76,380 KB
testcase_20 AC 83 ms
75,952 KB
testcase_21 AC 87 ms
76,148 KB
testcase_22 AC 84 ms
76,000 KB
testcase_23 AC 84 ms
75,896 KB
testcase_24 AC 82 ms
76,412 KB
testcase_25 AC 84 ms
76,416 KB
testcase_26 AC 83 ms
76,392 KB
testcase_27 AC 73 ms
71,508 KB
testcase_28 AC 86 ms
76,028 KB
testcase_29 AC 83 ms
75,876 KB
testcase_30 AC 82 ms
75,960 KB
testcase_31 AC 84 ms
76,484 KB
testcase_32 AC 89 ms
76,304 KB
testcase_33 AC 81 ms
75,860 KB
testcase_34 AC 86 ms
75,968 KB
testcase_35 AC 86 ms
76,392 KB
testcase_36 AC 84 ms
76,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=list(map(int,input().split()))
T=list(map(int,input().split()))
A=[[0]*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
X,Y=0,0
for i in range(N):
  if S[i]==1:
    for j in range(N):
      if A[i][j]==1:
        break
      if j==N-1:
        X+=1
  if T[i]==1:
    for j in range(N):
      if A[j][i]==1:
        break
      if j==N-1:
        Y+=1
print(sum([sum(A[i]) for i in range(N)])+max(X,Y))
0