結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー tonyu0
提出日時 2020-09-11 22:33:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 63,712 KB
最終ジャッジ日時 2024-12-27 16:12:38
合計ジャッジ時間 3,375 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(map(int, input().split()))
t = list(map(int, input().split()))

row = [0] * n
col = [0] * n

ans = 0
for i in range(n):
    if s[i] == 2:
        for j in range(n):
            ans += 1
            col[j] += 1
    if t[i] == 2:
        for j in range(n):
            ans += 1
            row[j] += 1

for i in range(n):
    for j in range(n):
        if s[i] == 1 and t[j] == 1:
            if row[i] == 0 and col[j] == 0:
                ans += 1
                row[i] += 1
                col[j] += 1

for i in range(n):
    if s[i] == 1 and row[i] == 0:
        ans += 1
    if t[i] == 1 and col[i] == 0:
        ans += 1

print(ans)
0