結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
|
| 提出日時 | 2022-10-10 09:06:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,158 ms / 5,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 84,420 KB |
| 最終ジャッジ日時 | 2024-06-24 04:44:49 |
| 合計ジャッジ時間 | 12,652 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B += B
Y = [(b,0) for b in A]
heapify(Y)
ans = N
for i in range(N):
h = Y[:]
tans = 0
for j in range(N):
a = B[i+j]
x,c = heappop(h)
x += a//2
c += 1
tans = max(tans,c)
heappush(h,(x,c))
ans = min(ans,tans)
print(ans)