結果

問題 No.9 モンスターのレベル上げ
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-08 18:23:24
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,813 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 275 ms
使用メモリ 86,804 KB
最終ジャッジ日時 2022-12-17 08:26:15
合計ジャッジ時間 19,944 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 82 ms
75,804 KB
testcase_01 AC 82 ms
75,760 KB
testcase_02 AC 1,813 ms
86,736 KB
testcase_03 AC 1,470 ms
85,376 KB
testcase_04 AC 874 ms
83,288 KB
testcase_05 AC 654 ms
83,544 KB
testcase_06 AC 362 ms
83,088 KB
testcase_07 AC 166 ms
82,344 KB
testcase_08 AC 410 ms
83,100 KB
testcase_09 AC 1,761 ms
86,804 KB
testcase_10 AC 77 ms
75,724 KB
testcase_11 AC 1,537 ms
85,936 KB
testcase_12 AC 1,635 ms
86,312 KB
testcase_13 AC 1,131 ms
85,312 KB
testcase_14 AC 1,749 ms
86,064 KB
testcase_15 AC 1,655 ms
85,796 KB
testcase_16 AC 206 ms
82,984 KB
testcase_17 AC 1,140 ms
85,248 KB
testcase_18 AC 980 ms
85,000 KB
testcase_19 AC 185 ms
82,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

B = B+B
import heapq
m = 1550
ans = 10**18
for i in range(n):
    q = []
    for a in A:
        q.append(a*m)
    heapq.heapify(q)
    for j in range(i, i+n):
        b = B[j]
        a = heapq.heappop(q)
        level, cnt = divmod(a, m)
        level += b//2
        cnt += 1
        na = level*m+cnt
        heapq.heappush(q, na)
    temp = 0
    while q:
        a = heapq.heappop(q)
        level, cnt = divmod(a, m)
        temp = max(temp, cnt)
    ans = min(ans, temp)
print(ans)
0