結果

問題 No.9 モンスターのレベル上げ
ユーザー nagitaosunagitaosu
提出日時 2020-03-13 10:24:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,424 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 91,516 KB
最終ジャッジ日時 2024-05-01 12:22:02
合計ジャッジ時間 15,084 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,816 KB
testcase_01 AC 41 ms
53,436 KB
testcase_02 AC 1,424 ms
91,516 KB
testcase_03 AC 1,189 ms
87,032 KB
testcase_04 AC 680 ms
80,960 KB
testcase_05 AC 492 ms
79,248 KB
testcase_06 AC 268 ms
77,472 KB
testcase_07 AC 102 ms
76,528 KB
testcase_08 AC 314 ms
77,528 KB
testcase_09 AC 1,395 ms
90,780 KB
testcase_10 AC 38 ms
53,208 KB
testcase_11 AC 1,097 ms
88,840 KB
testcase_12 AC 1,184 ms
88,992 KB
testcase_13 AC 809 ms
84,504 KB
testcase_14 AC 1,419 ms
90,620 KB
testcase_15 AC 1,279 ms
88,300 KB
testcase_16 AC 141 ms
76,528 KB
testcase_17 AC 890 ms
84,148 KB
testcase_18 AC 723 ms
82,376 KB
testcase_19 AC 129 ms
76,776 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