結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー nagitaosu
提出日時 2020-03-13 10:24:12
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 826 ms / 5,000 ms
+ 499µs
コード長 526 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 204 ms
コンパイル使用メモリ 83,500 KB
実行使用メモリ 96,064 KB
最終ジャッジ日時 2026-09-27 15:29:17
合計ジャッジ時間 9,659 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_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