結果
| 問題 | No.1225 I hate I hate Matrix Construction |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-11 21:42:07 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 21 ms / 2,000 ms |
| + 108µs | |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 15,232 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2026-10-08 13:32:36 |
| 合計ジャッジ時間 | 2,929 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)