結果

問題 No.9 モンスターのレベル上げ
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-08 18:23:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,817 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 81,068 KB
最終ジャッジ日時 2024-04-28 04:32:07
合計ジャッジ時間 19,543 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 42 ms
52,736 KB
testcase_02 AC 1,817 ms
81,068 KB
testcase_03 AC 1,406 ms
79,716 KB
testcase_04 AC 827 ms
77,848 KB
testcase_05 AC 610 ms
77,428 KB
testcase_06 AC 315 ms
77,132 KB
testcase_07 AC 121 ms
77,392 KB
testcase_08 AC 373 ms
76,892 KB
testcase_09 AC 1,798 ms
80,808 KB
testcase_10 AC 41 ms
52,224 KB
testcase_11 AC 1,575 ms
79,752 KB
testcase_12 AC 1,650 ms
80,256 KB
testcase_13 AC 1,173 ms
78,964 KB
testcase_14 AC 1,703 ms
79,984 KB
testcase_15 AC 1,632 ms
79,820 KB
testcase_16 AC 153 ms
76,900 KB
testcase_17 AC 1,109 ms
78,964 KB
testcase_18 AC 936 ms
78,012 KB
testcase_19 AC 138 ms
76,568 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