結果

問題 No.9 モンスターのレベル上げ
ユーザー qibqib
提出日時 2023-03-20 00:07:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,039 ms / 5,000 ms
コード長 473 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 79,516 KB
最終ジャッジ日時 2023-10-18 17:56:11
合計ジャッジ時間 12,138 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,552 KB
testcase_01 AC 36 ms
53,552 KB
testcase_02 AC 1,019 ms
79,332 KB
testcase_03 AC 831 ms
78,484 KB
testcase_04 AC 484 ms
77,016 KB
testcase_05 AC 365 ms
76,740 KB
testcase_06 AC 207 ms
76,240 KB
testcase_07 AC 99 ms
76,040 KB
testcase_08 AC 246 ms
76,512 KB
testcase_09 AC 1,039 ms
79,240 KB
testcase_10 AC 39 ms
53,552 KB
testcase_11 AC 900 ms
79,100 KB
testcase_12 AC 983 ms
79,516 KB
testcase_13 AC 665 ms
77,768 KB
testcase_14 AC 1,012 ms
79,272 KB
testcase_15 AC 959 ms
78,672 KB
testcase_16 AC 115 ms
76,104 KB
testcase_17 AC 672 ms
77,792 KB
testcase_18 AC 550 ms
77,172 KB
testcase_19 AC 115 ms
76,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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