結果

問題 No.9 モンスターのレベル上げ
ユーザー htkb
提出日時 2019-02-08 16:31:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,487 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-06-28 10:51:19
合計ジャッジ時間 14,426 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappushpop
N = int(input())
WEAKEST, *A = sorted(map(lambda x: int(x)*10000, input().split()))
B = list(map(lambda x: int(x)//2*10000+1, input().split()))
ans = 10**9

for i in range(N):
    a = A[:]
    weakest = WEAKEST
    for exp in B[i:] + B[:i]:
        weakest = heappushpop(a, weakest+exp)

    ans = min(ans, max(n % 10000 for n in a+[weakest]))

print(ans)
0