結果

問題 No.9 モンスターのレベル上げ
ユーザー rlangevinrlangevin
提出日時 2023-11-23 22:34:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,143 ms / 5,000 ms
コード長 564 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 79,652 KB
最終ジャッジ日時 2023-11-23 22:35:07
合計ジャッジ時間 12,793 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 1,086 ms
79,288 KB
testcase_03 AC 949 ms
78,516 KB
testcase_04 AC 558 ms
77,080 KB
testcase_05 AC 389 ms
76,704 KB
testcase_06 AC 217 ms
76,296 KB
testcase_07 AC 104 ms
76,056 KB
testcase_08 AC 244 ms
76,436 KB
testcase_09 AC 1,121 ms
79,552 KB
testcase_10 AC 38 ms
53,460 KB
testcase_11 AC 990 ms
79,148 KB
testcase_12 AC 1,143 ms
79,652 KB
testcase_13 AC 708 ms
77,632 KB
testcase_14 AC 1,107 ms
79,524 KB
testcase_15 AC 1,047 ms
78,772 KB
testcase_16 AC 123 ms
76,064 KB
testcase_17 AC 718 ms
78,028 KB
testcase_18 AC 583 ms
77,656 KB
testcase_19 AC 133 ms
76,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

def f(x, y):
    return x * (N + 1) + y
def g(v):
    return v // (N + 1), v % (N + 1)

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B = B + B
ans = 10 ** 18
for i in range(N):
    H = []
    for j in range(N):
        heappush(H, f(A[j], 0))
        
    for j in range(i, i + N):
        nx, ny = g(heappop(H))
        ny += 1
        nx += B[j]//2
        heappush(H, f(nx, ny))
    temp = 0
    for v in H:
        x, y = g(v)
        temp = max(temp, y)
    ans = min(ans, temp)
    
print(ans)
0