結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-12 21:42:14 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 739 ms / 5,000 ms |
| コード長 | 404 bytes |
| 記録 | |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 85,276 KB |
| 実行使用メモリ | 89,520 KB |
| 最終ジャッジ日時 | 2026-03-17 16:33:29 |
| 合計ジャッジ時間 | 7,604 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
from heapq import heappush, heappop, heapify
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B = [b//2 for b in B]
B += B
ans = 10**10
base = [(a,0) for a in A]
heapify(base)
for i in range(n):
h = base.copy()
for j in range(i,i+n):
a,num = heappop(h)
heappush(h, (a+B[j],num+1))
m = max(i for _,i in h)
ans = min(ans,m)
print(ans)