結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-11 21:42:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 395 bytes |
| コンパイル時間 | 211 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-27 09:04:13 |
| 合計ジャッジ時間 | 2,550 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
from collections import Counter
N = int(input())
S = Counter(map(int, input().split()))
T = Counter(map(int, input().split()))
flag_vertical = 2 in S
flag_horizontal = 2 in T
if flag_vertical and flag_horizontal:
ans = (S[2] + T[2]) * N - S[2] * T[2]
elif flag_vertical:
ans = S[2] * N + S[1]
elif flag_horizontal:
ans = T[2] * N + T[1]
else:
ans = max(S[1], T[1])
print(ans)