結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-20 00:07:32 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 747 ms / 5,000 ms |
| コード長 | 473 bytes |
| 記録 | |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 84,156 KB |
| 最終ジャッジ日時 | 2026-04-06 17:04:09 |
| 合計ジャッジ時間 | 8,490 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import heapq
INF = 10 ** 5
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 1 << 60
for src in range(n):
hp = []
for i in range(n):
heapq.heappush(hp, INF * a[i])
for i in range(n):
x = heapq.heappop(hp)
l, c = x // INF, x % INF
l += b[(i + src) % n] // 2
c += 1
heapq.heappush(hp, l * INF + c)
cnt = 0
for x in hp:
c = x % INF
cnt = max(cnt, c)
ans = min(ans, cnt)
print(ans)