結果
| 問題 | No.1225 I hate I hate Matrix Construction |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-15 17:07:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 64,896 KB |
| 最終ジャッジ日時 | 2024-11-07 04:31:53 |
| 合計ジャッジ時間 | 3,501 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 12 |
ソースコード
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:
ans+=cnt_col
elif row1:
ans+=cnt_row
else:
ans+=min(cnt_row,cnt_col)
print(ans)