結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー tonyu0tonyu0
提出日時 2020-09-11 22:33:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 76,588 KB
最終ジャッジ日時 2023-08-27 15:24:07
合計ジャッジ時間 4,337 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,436 KB
testcase_01 AC 62 ms
71,428 KB
testcase_02 AC 62 ms
71,416 KB
testcase_03 AC 68 ms
75,588 KB
testcase_04 AC 72 ms
76,276 KB
testcase_05 AC 71 ms
75,724 KB
testcase_06 AC 74 ms
76,300 KB
testcase_07 AC 70 ms
75,772 KB
testcase_08 AC 72 ms
75,664 KB
testcase_09 AC 74 ms
76,008 KB
testcase_10 AC 72 ms
76,432 KB
testcase_11 AC 73 ms
76,168 KB
testcase_12 AC 71 ms
76,004 KB
testcase_13 AC 72 ms
75,832 KB
testcase_14 AC 68 ms
75,896 KB
testcase_15 AC 68 ms
76,376 KB
testcase_16 AC 69 ms
76,204 KB
testcase_17 AC 71 ms
75,988 KB
testcase_18 AC 71 ms
75,976 KB
testcase_19 AC 70 ms
76,000 KB
testcase_20 AC 69 ms
76,504 KB
testcase_21 AC 72 ms
76,124 KB
testcase_22 AC 77 ms
76,388 KB
testcase_23 AC 75 ms
76,332 KB
testcase_24 AC 74 ms
76,264 KB
testcase_25 AC 72 ms
76,176 KB
testcase_26 AC 71 ms
76,172 KB
testcase_27 WA -
testcase_28 AC 73 ms
76,416 KB
testcase_29 AC 72 ms
76,240 KB
testcase_30 AC 72 ms
76,080 KB
testcase_31 AC 75 ms
76,328 KB
testcase_32 AC 72 ms
76,012 KB
testcase_33 AC 69 ms
76,444 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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