結果

問題 No.9 モンスターのレベル上げ
ユーザー ayaoniayaoni
提出日時 2020-12-04 09:32:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,381 ms / 5,000 ms
コード長 901 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 83,160 KB
最終ジャッジ日時 2023-10-12 21:43:33
合計ジャッジ時間 15,329 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,592 KB
testcase_01 AC 91 ms
71,668 KB
testcase_02 AC 1,379 ms
83,160 KB
testcase_03 AC 1,103 ms
81,800 KB
testcase_04 AC 678 ms
79,844 KB
testcase_05 AC 522 ms
79,704 KB
testcase_06 AC 300 ms
79,048 KB
testcase_07 AC 157 ms
79,200 KB
testcase_08 AC 340 ms
79,528 KB
testcase_09 AC 1,381 ms
83,008 KB
testcase_10 AC 92 ms
71,712 KB
testcase_11 AC 1,111 ms
82,248 KB
testcase_12 AC 1,163 ms
82,204 KB
testcase_13 AC 1,010 ms
81,480 KB
testcase_14 AC 1,353 ms
82,660 KB
testcase_15 AC 1,242 ms
82,584 KB
testcase_16 AC 183 ms
78,700 KB
testcase_17 AC 880 ms
81,256 KB
testcase_18 AC 755 ms
80,164 KB
testcase_19 AC 164 ms
78,736 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