結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー nagitaosu
提出日時 2020-03-13 10:24:12
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 905 ms / 5,000 ms
コード長 526 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 536 ms
コンパイル使用メモリ 85,632 KB
実行使用メモリ 94,256 KB
最終ジャッジ日時 2026-05-15 20:16:27
合計ジャッジ時間 10,228 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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