結果

問題 No.9 モンスターのレベル上げ
ユーザー ayaoniayaoni
提出日時 2020-12-04 09:26:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 865 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 79,752 KB
最終ジャッジ日時 2023-10-12 21:35:29
合計ジャッジ時間 14,527 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,112 KB
testcase_01 AC 80 ms
71,360 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 79 ms
71,460 KB
testcase_11 AC 1,060 ms
79,224 KB
testcase_12 WA -
testcase_13 AC 804 ms
79,400 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 786 ms
79,292 KB
testcase_18 AC 660 ms
78,744 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from heapq import heappop,heappush,heapify
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 = 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