結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー ygd.ygd.
提出日時 2020-09-11 22:19:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 71,900 KB
最終ジャッジ日時 2023-08-27 15:05:24
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,800 KB
testcase_01 AC 94 ms
71,672 KB
testcase_02 AC 95 ms
71,616 KB
testcase_03 AC 98 ms
71,780 KB
testcase_04 AC 95 ms
71,576 KB
testcase_05 AC 93 ms
71,584 KB
testcase_06 AC 95 ms
71,424 KB
testcase_07 AC 94 ms
71,628 KB
testcase_08 AC 95 ms
71,620 KB
testcase_09 AC 94 ms
71,672 KB
testcase_10 AC 95 ms
71,716 KB
testcase_11 AC 95 ms
71,580 KB
testcase_12 AC 96 ms
71,672 KB
testcase_13 AC 95 ms
71,604 KB
testcase_14 AC 95 ms
71,616 KB
testcase_15 AC 96 ms
71,636 KB
testcase_16 AC 96 ms
71,568 KB
testcase_17 AC 95 ms
71,900 KB
testcase_18 AC 93 ms
71,820 KB
testcase_19 AC 94 ms
71,816 KB
testcase_20 AC 93 ms
71,696 KB
testcase_21 AC 96 ms
71,612 KB
testcase_22 AC 94 ms
71,372 KB
testcase_23 AC 95 ms
71,676 KB
testcase_24 AC 95 ms
71,820 KB
testcase_25 AC 94 ms
71,712 KB
testcase_26 AC 93 ms
71,572 KB
testcase_27 AC 92 ms
71,524 KB
testcase_28 AC 95 ms
71,672 KB
testcase_29 AC 96 ms
71,820 KB
testcase_30 AC 94 ms
71,424 KB
testcase_31 AC 95 ms
71,796 KB
testcase_32 AC 92 ms
71,720 KB
testcase_33 AC 94 ms
71,528 KB
testcase_34 AC 94 ms
71,692 KB
testcase_35 AC 94 ms
71,572 KB
testcase_36 AC 94 ms
71,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
dicS = defaultdict(int); dicT = defaultdict(int)
for i in range(N):
  dicS[S[i]] += 1
  dicT[T[i]] += 1

if dicS[2] == 0 and dicT[2] == 0:
  ans = max(dicS[1],dicT[1])
elif dicS[2] == 0:
  ans = N*dicT[2] + (N-dicT[2]-dicT[0])
elif dicT[2] == 0:
  ans = N*dicS[2] + (N-dicS[2]-dicS[0])
else:
  ans = N*(dicS[2]+dicT[2]) - (dicS[2]*dicT[2])
print(ans)
0