結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
ygd.
|
| 提出日時 | 2020-09-11 22:19:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 474 bytes |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 54,144 KB |
| 最終ジャッジ日時 | 2024-12-27 15:14:43 |
| 合計ジャッジ時間 | 2,984 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
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)
ygd.