結果
問題 |
No.1225 I hate I hate Matrix Construction
|
ユーザー |
|
提出日時 | 2021-03-15 17:08:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 664 bytes |
コンパイル時間 | 386 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 64,768 KB |
最終ジャッジ日時 | 2024-11-07 04:33:22 |
合計ジャッジ時間 | 3,452 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 WA * 9 |
ソースコード
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+=min(cnt_row,cnt_col) print(ans)