結果

問題 No.9 モンスターのレベル上げ
ユーザー htkbhtkb
提出日時 2019-02-08 16:31:01
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 1,303 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 71 ms
使用メモリ 8,236 KB
最終ジャッジ日時 2023-01-28 03:01:54
合計ジャッジ時間 13,308 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 16 ms
7,712 KB
testcase_01 AC 17 ms
7,760 KB
testcase_02 AC 1,303 ms
8,024 KB
testcase_03 AC 991 ms
8,236 KB
testcase_04 AC 552 ms
7,988 KB
testcase_05 AC 365 ms
7,908 KB
testcase_06 AC 141 ms
7,856 KB
testcase_07 AC 18 ms
7,840 KB
testcase_08 AC 182 ms
7,880 KB
testcase_09 AC 1,232 ms
8,068 KB
testcase_10 AC 16 ms
7,660 KB
testcase_11 AC 1,153 ms
8,184 KB
testcase_12 AC 555 ms
8,068 KB
testcase_13 AC 1,101 ms
7,936 KB
testcase_14 AC 1,220 ms
8,068 KB
testcase_15 AC 1,148 ms
8,164 KB
testcase_16 AC 37 ms
7,692 KB
testcase_17 AC 731 ms
7,964 KB
testcase_18 AC 614 ms
7,816 KB
testcase_19 AC 29 ms
7,788 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