結果

問題 No.9 モンスターのレベル上げ
ユーザー tnodinotnodino
提出日時 2022-05-26 18:13:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,408 ms / 5,000 ms
コード長 510 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 81,472 KB
実行使用メモリ 96,084 KB
最終ジャッジ日時 2023-10-20 19:31:04
合計ジャッジ時間 24,783 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,444 KB
testcase_01 AC 43 ms
55,444 KB
testcase_02 AC 2,408 ms
93,848 KB
testcase_03 AC 2,006 ms
89,932 KB
testcase_04 AC 1,154 ms
81,704 KB
testcase_05 AC 815 ms
79,768 KB
testcase_06 AC 409 ms
77,868 KB
testcase_07 AC 125 ms
77,068 KB
testcase_08 AC 476 ms
78,596 KB
testcase_09 AC 2,318 ms
93,380 KB
testcase_10 AC 43 ms
55,484 KB
testcase_11 AC 2,055 ms
94,088 KB
testcase_12 AC 2,114 ms
86,304 KB
testcase_13 AC 2,007 ms
96,084 KB
testcase_14 AC 2,312 ms
94,628 KB
testcase_15 AC 2,181 ms
92,580 KB
testcase_16 AC 186 ms
77,088 KB
testcase_17 AC 1,460 ms
85,396 KB
testcase_18 AC 1,241 ms
82,956 KB
testcase_19 AC 151 ms
76,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
from heapq import heappop,heappush
def f(x):
    heap = deepcopy(H)
    ret = 0
    for i in range(N):
        level,cnt = heappop(heap)
        level += B[(x+i)%N]
        cnt += 1
        ret = max(ret, cnt)
        heappush(heap, (level, cnt))
    return ret

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
H = []
for i in range(N):
    heappush(H, (A[i], 0))
    B[i] //= 2
ans = 1<<32
for i in range(N):
    ans = min(ans, f(i))
print(ans)
0