結果

問題 No.9 モンスターのレベル上げ
ユーザー H3PO4H3PO4
提出日時 2020-04-19 09:01:13
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 2,373 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 333 ms
使用メモリ 8,156 KB
最終ジャッジ日時 2022-11-27 22:16:17
合計ジャッジ時間 23,768 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,852 KB
testcase_01 AC 14 ms
7,756 KB
testcase_02 AC 2,272 ms
8,124 KB
testcase_03 AC 1,851 ms
8,152 KB
testcase_04 AC 992 ms
7,820 KB
testcase_05 AC 691 ms
7,832 KB
testcase_06 AC 234 ms
7,932 KB
testcase_07 AC 20 ms
7,764 KB
testcase_08 AC 327 ms
7,868 KB
testcase_09 AC 2,320 ms
8,072 KB
testcase_10 AC 16 ms
7,804 KB
testcase_11 AC 2,152 ms
8,120 KB
testcase_12 AC 2,133 ms
7,996 KB
testcase_13 AC 1,951 ms
7,984 KB
testcase_14 AC 2,373 ms
8,156 KB
testcase_15 AC 2,079 ms
8,128 KB
testcase_16 AC 53 ms
7,648 KB
testcase_17 AC 1,354 ms
8,116 KB
testcase_18 AC 1,172 ms
7,948 KB
testcase_19 AC 36 ms
7,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split())) * 2

ans = float('inf')
for i in range(N):
    heapq.heapify(h := [a * 10000 for a in A])
    for j in range(N):
        x = heapq.heappop(h)
        x += (B[i + j] // 2) * 10000 + 1
        heapq.heappush(h, x)
    ans = min(ans, max(a % 10000 for a in h))
print(ans)
0