結果
| 問題 |
No.1122 Plane Tickets
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-26 15:57:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 822 bytes |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 82,708 KB |
| 実行使用メモリ | 54,664 KB |
| 最終ジャッジ日時 | 2025-03-26 15:57:54 |
| 合計ジャッジ時間 | 4,193 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 WA * 13 |
ソースコード
import itertools
def max_flights(a, b, c, d, e):
from itertools import permutations
combinations = [
(0, 1, 2), # A, B, C
(1, 2, 3), # B, C, D
(2, 3, 4), # C, D, E
(3, 4, 0), # D, E, A
(4, 0, 1) # E, A, B
]
max_s = 0
for perm in permutations(range(5)):
aa, bb, cc, dd, ee = a, b, c, d, e
s = 0
for idx in perm:
i, j, k = combinations[idx]
current = [aa, bb, cc, dd, ee]
x = min(current[i], current[j], current[k])
s += x
current[i] -= x
current[j] -= x
current[k] -= x
aa, bb, cc, dd, ee = current
if s > max_s:
max_s = s
return max_s
a, b, c, d, e = map(int, input().split())
print(max_flights(a, b, c, d, e))
lam6er