結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-03-13 10:24:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,385 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 675 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 91,896 KB |
最終ジャッジ日時 | 2024-11-21 16:42:46 |
合計ジャッジ時間 | 14,543 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#!/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)