結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-25 16:24:19 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 1,550 ms / 5,000 ms |
| + 789µs | |
| コード長 | 550 bytes |
| 記録 | |
| コンパイル時間 | 888 ms |
| コンパイル使用メモリ | 21,412 KB |
| 実行使用メモリ | 15,992 KB |
| 最終ジャッジ日時 | 2026-08-03 20:02:27 |
| 合計ジャッジ時間 | 15,977 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
from heapq import heapify, heapreplace
def main():
""" main """
N = int(input())
FRIENDS = list(map(lambda x: (int(x), 0), input().split()))
ENEMIES = list(map(lambda x: int(x)//2, input().split()))
heapify(FRIENDS)
max_value = float('inf')
for n in range(N):
friends = FRIENDS[:]
for enemy in ENEMIES[n:] + ENEMIES[:n]:
lv, cnt = friends[0]
heapreplace(friends, (lv+enemy, cnt+1))
max_value = min(max_value, max(cnt for lv, cnt in friends))
print(max_value)
main()