結果

問題 No.9 モンスターのレベル上げ
ユーザー tnodinotnodino
提出日時 2022-01-31 04:21:02
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 2,544 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 260 ms
使用メモリ 102,604 KB
最終ジャッジ日時 2023-01-18 04:52:52
合計ジャッジ時間 27,091 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 94 ms
75,828 KB
testcase_01 AC 95 ms
76,128 KB
testcase_02 AC 2,544 ms
100,984 KB
testcase_03 AC 2,069 ms
96,972 KB
testcase_04 AC 1,213 ms
89,008 KB
testcase_05 AC 894 ms
88,076 KB
testcase_06 AC 491 ms
85,532 KB
testcase_07 AC 181 ms
83,872 KB
testcase_08 AC 549 ms
84,972 KB
testcase_09 AC 2,465 ms
101,724 KB
testcase_10 AC 94 ms
75,964 KB
testcase_11 AC 2,203 ms
100,484 KB
testcase_12 AC 2,225 ms
92,520 KB
testcase_13 AC 2,177 ms
102,604 KB
testcase_14 AC 2,502 ms
99,948 KB
testcase_15 AC 2,332 ms
97,068 KB
testcase_16 AC 250 ms
83,984 KB
testcase_17 AC 1,579 ms
91,448 KB
testcase_18 AC 1,371 ms
90,296 KB
testcase_19 AC 215 ms
84,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
from heapq import heappop,heappush
def Check(N, L, heap, x):
    ret = 0
    for i in range(N):
        Level,cnt = heappop(heap)
        Level += L[(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()))
heap = []
for i in range(N):
    heappush(heap, (A[i], 0))
    B[i] //= 2
ans = 1<<32
for i in range(N):
    ans = min(ans, Check(N, B, deepcopy(heap), i))
print(ans)
0