結果
| 問題 | No.1225 I hate I hate Matrix Construction | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-15 17:12:01 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 87 ms / 2,000 ms | 
| コード長 | 684 bytes | 
| コンパイル時間 | 184 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 64,512 KB | 
| 最終ジャッジ日時 | 2024-11-07 04:35:58 | 
| 合計ジャッジ時間 | 3,214 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 35 | 
ソースコード
n=int(input())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=[[None]*n for _ in range(n)]
row1,col1=False,False
cnt_row,cnt_col=0,0
ans=0
for i,x in enumerate(s):
  if x==0:
    for j in range(n):
      a[i][j]=0
  elif x==2:
    for j in range(n):
      a[i][j]=1
    row1=True
  else:
    cnt_row+=1
for i,x in enumerate(t):
  if x==0:
    for j in range(n):
      a[j][i]=0
  elif x==2:
    for j in range(n):
      a[j][i]=1
    col1=True
  else:
    cnt_col+=1
for y in a:
  for x in y:
    if x is not None:ans+=x
if col1 and row1:
  pass
elif col1:
  ans+=cnt_col
elif row1:
  ans+=cnt_row
else:
  ans+=max(cnt_row,cnt_col)
print(ans)
#for x in a:print(x)
            
            
            
        