結果

問題 No.9 モンスターのレベル上げ
ユーザー nagitaosunagitaosu
提出日時 2020-03-13 10:24:12
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,438 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 593 ms
使用メモリ 97,604 KB
最終ジャッジ日時 2022-12-27 06:24:37
合計ジャッジ時間 16,587 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 87 ms
75,696 KB
testcase_01 AC 87 ms
75,828 KB
testcase_02 AC 1,356 ms
97,604 KB
testcase_03 AC 1,179 ms
92,948 KB
testcase_04 AC 701 ms
87,620 KB
testcase_05 AC 521 ms
84,820 KB
testcase_06 AC 312 ms
83,268 KB
testcase_07 AC 151 ms
82,492 KB
testcase_08 AC 358 ms
83,200 KB
testcase_09 AC 1,406 ms
96,936 KB
testcase_10 AC 88 ms
75,604 KB
testcase_11 AC 1,137 ms
95,200 KB
testcase_12 AC 1,161 ms
94,384 KB
testcase_13 AC 843 ms
89,600 KB
testcase_14 AC 1,438 ms
96,308 KB
testcase_15 AC 1,257 ms
94,492 KB
testcase_16 AC 183 ms
82,340 KB
testcase_17 AC 904 ms
89,312 KB
testcase_18 AC 744 ms
88,300 KB
testcase_19 AC 173 ms
82,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from heapq import heappush, heappop

n = int(input())
a = [int(item) for item in input().split()]
b = [int(item) for item in input().split()]

ans = 10**9 
for diff in range(n):
    hq = []
    ret = 0
    for item in a:
        heappush(hq, (item, 0))
    for i in range(diff, diff + n):
        lv, times = heappop(hq)
        heappush(hq, (lv + b[i % n] // 2, times + 1))
        if ret < times + 1:
            ret = times + 1
    ans = min(ans, ret)
print(ans)
0