結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー qib
提出日時 2023-03-20 00:07:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 747 ms / 5,000 ms
コード長 473 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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
権限があれば一括ダウンロードができます

ソースコード

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