結果

問題 No.9 モンスターのレベル上げ
ユーザー nagitaosunagitaosu
提出日時 2020-03-13 10:24:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,412 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 94,136 KB
最終ジャッジ日時 2023-08-13 22:40:35
合計ジャッジ時間 15,950 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,192 KB
testcase_01 AC 81 ms
71,108 KB
testcase_02 AC 1,412 ms
94,136 KB
testcase_03 AC 1,191 ms
89,460 KB
testcase_04 AC 693 ms
82,120 KB
testcase_05 AC 513 ms
81,476 KB
testcase_06 AC 306 ms
78,924 KB
testcase_07 AC 139 ms
78,172 KB
testcase_08 AC 348 ms
79,008 KB
testcase_09 AC 1,386 ms
92,016 KB
testcase_10 AC 82 ms
71,180 KB
testcase_11 AC 1,172 ms
90,636 KB
testcase_12 AC 1,191 ms
90,504 KB
testcase_13 AC 843 ms
85,736 KB
testcase_14 AC 1,409 ms
92,112 KB
testcase_15 AC 1,295 ms
89,808 KB
testcase_16 AC 170 ms
78,068 KB
testcase_17 AC 932 ms
85,352 KB
testcase_18 AC 751 ms
83,608 KB
testcase_19 AC 159 ms
78,372 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