結果
| 問題 | 
                            No.1225 I hate I hate Matrix Construction
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-05-13 19:57:55 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 675 bytes | 
| コンパイル時間 | 253 ms | 
| コンパイル使用メモリ | 82,424 KB | 
| 実行使用メモリ | 63,872 KB | 
| 最終ジャッジ日時 | 2024-07-21 22:55:19 | 
| 合計ジャッジ時間 | 3,425 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 30 WA * 5 | 
ソースコード
N = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
yoko = 0
tate = 0
ans = 0
dat = [[-1] * N for _ in range(N)]
sflag = False
tflag = False
for i in range(N):
    for j in range(N):
        if S[i] == 0 or T[j] == 0:
            dat[i][j] = 0
        elif S[i] == 2 or T[j] == 2:
            ans += 1
            dat[i][j] = 1
for s in S:
    if s == 1:
        yoko += 1
    elif s == 2:
        sflag = True
for t in T:
    if t == 1:
        tate += 1
    elif t == 2:
        tflag = True
        
if sflag and tflag:
    pass
elif not sflag:
    ans += tate
elif not tflag:
    ans += yoko
else:
    ans += max(yoko,tate)
print(ans)