結果

問題 No.9 モンスターのレベル上げ
ユーザー ayaoniayaoni
提出日時 2020-12-04 09:32:55
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,449 ms / 5,000 ms
コード長 901 bytes
コンパイル時間 281 ms
使用メモリ 87,632 KB
最終ジャッジ日時 2023-02-27 11:18:31
合計ジャッジ時間 16,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 109 ms
75,936 KB
testcase_01 AC 108 ms
75,936 KB
testcase_02 AC 1,448 ms
87,632 KB
testcase_03 AC 1,182 ms
85,780 KB
testcase_04 AC 731 ms
83,884 KB
testcase_05 AC 564 ms
83,820 KB
testcase_06 AC 341 ms
83,816 KB
testcase_07 AC 178 ms
82,996 KB
testcase_08 AC 374 ms
83,568 KB
testcase_09 AC 1,449 ms
87,488 KB
testcase_10 AC 108 ms
76,084 KB
testcase_11 AC 1,164 ms
86,404 KB
testcase_12 AC 1,299 ms
87,280 KB
testcase_13 AC 1,074 ms
86,732 KB
testcase_14 AC 1,442 ms
86,472 KB
testcase_15 AC 1,338 ms
86,360 KB
testcase_16 AC 215 ms
83,232 KB
testcase_17 AC 958 ms
85,344 KB
testcase_18 AC 830 ms
84,368 KB
testcase_19 AC 197 ms
82,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from heapq import heappop,heappush,heapify
from copy import deepcopy
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A,B = LI(),LI()
A = [A[i]<<11 for i in range(N)]
B = [B[i]//2 for i in range(N)]
B = B+B

ans = 10**18
for i in range(N):
    X = deepcopy(A)
    heapify(X)
    for j in range(N):
        n = heappop(X)
        n0,n1 = divmod(n,1<<11)
        n0 += B[i+j]
        n1 += 1
        heappush(X,(n0<<11)+n1)
    ans = min(ans,max(X[i] % (1<<11) for i in range(N)))

print(ans)
0