結果
| 問題 |
No.2495 Three Sets
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-07 05:55:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,076 ms / 3,000 ms |
| コード長 | 890 bytes |
| コンパイル時間 | 445 ms |
| コンパイル使用メモリ | 82,392 KB |
| 実行使用メモリ | 102,784 KB |
| 最終ジャッジ日時 | 2024-07-26 17:42:09 |
| 合計ジャッジ時間 | 19,716 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
na, nb, nc = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) acn = [0] * 6001 bcn = [0] * 6001 ccn = [0] * 6001 asm = [0] * 6001 bsm = [0] * 6001 csm = [0] * 6001 for i in a: acn[i + 3000] += 1 asm[i + 3000] += i for i in b: bcn[i + 3000] += 1 bsm[i + 3000] += i for i in c: ccn[i + 3000] += 1 csm[i + 3000] += i for i in range(6000, 0, -1): acn[i - 1] += acn[i] asm[i - 1] += asm[i] bcn[i - 1] += bcn[i] bsm[i - 1] += bsm[i] ccn[i - 1] += ccn[i] csm[i - 1] += csm[i] ans = 0 for j in range(6001): for k in range(6001): if bcn[j] == 0: ans = max(ans, max(0, na * csm[k]) + bsm[j] * ccn[k]) else: x = (-csm[k] - 1) // bcn[j] + 1 ans = max(ans, (0 if x > 3000 else acn[max(0, x + 3000)]) * csm[k] + bsm[j] * ccn[k] + bcn[j] * (0 if x > 3000 else asm[max(0, x + 3000)])) print(ans)