結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー qib
提出日時 2023-03-20 00:07:32
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 754 ms / 5,000 ms
+ 684µs
コード長 473 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 240 ms
コンパイル使用メモリ 95,216 KB
実行使用メモリ 87,752 KB
最終ジャッジ日時 2026-08-30 06:22:16
合計ジャッジ時間 9,620 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0