結果

問題 No.9 モンスターのレベル上げ
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-02 05:48:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,227 ms / 5,000 ms
コード長 376 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 95,780 KB
最終ジャッジ日時 2024-04-20 00:54:48
合計ジャッジ時間 12,384 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,960 KB
testcase_01 AC 36 ms
52,952 KB
testcase_02 AC 1,212 ms
94,804 KB
testcase_03 AC 999 ms
90,772 KB
testcase_04 AC 587 ms
82,424 KB
testcase_05 AC 444 ms
80,568 KB
testcase_06 AC 245 ms
78,096 KB
testcase_07 AC 94 ms
76,768 KB
testcase_08 AC 277 ms
78,388 KB
testcase_09 AC 1,143 ms
94,584 KB
testcase_10 AC 36 ms
53,000 KB
testcase_11 AC 875 ms
87,664 KB
testcase_12 AC 763 ms
85,804 KB
testcase_13 AC 795 ms
86,056 KB
testcase_14 AC 1,227 ms
95,780 KB
testcase_15 AC 1,119 ms
92,736 KB
testcase_16 AC 130 ms
76,664 KB
testcase_17 AC 741 ms
85,352 KB
testcase_18 AC 657 ms
83,680 KB
testcase_19 AC 107 ms
76,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split())) * 2

ans = N
for i in range(N):
    P = [(a, 0) for a in A]
    heapq.heapify(P)
    for j in range(N):
        a, c = heapq.heappop(P)
        a += B[i+j]//2
        c += 1
        heapq.heappush(P, (a, c))
    tmp = max(c for _, c in P)
    ans = min(ans, tmp)

print(ans)
0