結果

問題 No.9 モンスターのレベル上げ
ユーザー brthyyjp
提出日時 2021-11-08 18:23:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,854 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,233 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 80,588 KB
最終ジャッジ日時 2024-11-16 14:45:14
合計ジャッジ時間 19,715 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

B = B+B
import heapq
m = 1550
ans = 10**18
for i in range(n):
    q = []
    for a in A:
        q.append(a*m)
    heapq.heapify(q)
    for j in range(i, i+n):
        b = B[j]
        a = heapq.heappop(q)
        level, cnt = divmod(a, m)
        level += b//2
        cnt += 1
        na = level*m+cnt
        heapq.heappush(q, na)
    temp = 0
    while q:
        a = heapq.heappop(q)
        level, cnt = divmod(a, m)
        temp = max(temp, cnt)
    ans = min(ans, temp)
print(ans)
0