結果

問題 No.9 モンスターのレベル上げ
ユーザー htkbhtkb
提出日時 2019-02-08 16:31:01
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,301 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 8,524 KB
最終ジャッジ日時 2023-09-10 19:44:43
合計ジャッジ時間 13,316 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,008 KB
testcase_01 AC 16 ms
8,052 KB
testcase_02 AC 1,301 ms
8,332 KB
testcase_03 AC 1,018 ms
8,504 KB
testcase_04 AC 554 ms
8,300 KB
testcase_05 AC 372 ms
8,332 KB
testcase_06 AC 143 ms
8,068 KB
testcase_07 AC 19 ms
8,020 KB
testcase_08 AC 182 ms
8,032 KB
testcase_09 AC 1,287 ms
8,300 KB
testcase_10 AC 16 ms
7,964 KB
testcase_11 AC 1,204 ms
8,520 KB
testcase_12 AC 586 ms
8,436 KB
testcase_13 AC 1,098 ms
8,520 KB
testcase_14 AC 1,278 ms
8,460 KB
testcase_15 AC 1,153 ms
8,524 KB
testcase_16 AC 36 ms
7,960 KB
testcase_17 AC 770 ms
8,396 KB
testcase_18 AC 637 ms
8,020 KB
testcase_19 AC 28 ms
7,960 KB
権限があれば一括ダウンロードができます

ソースコード

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