結果

問題 No.9 モンスターのレベル上げ
ユーザー mkawa2mkawa2
提出日時 2020-01-02 09:22:31
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 2,979 ms / 5,000 ms
コード長 1,154 bytes
コンパイル時間 65 ms
使用メモリ 29,580 KB
最終ジャッジ日時 2022-12-28 04:23:09
合計ジャッジ時間 27,332 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 133 ms
29,136 KB
testcase_01 AC 134 ms
28,956 KB
testcase_02 AC 2,620 ms
29,504 KB
testcase_03 AC 1,956 ms
29,440 KB
testcase_04 AC 1,098 ms
29,184 KB
testcase_05 AC 777 ms
29,340 KB
testcase_06 AC 356 ms
29,328 KB
testcase_07 AC 135 ms
29,136 KB
testcase_08 AC 432 ms
29,144 KB
testcase_09 AC 2,571 ms
29,404 KB
testcase_10 AC 131 ms
28,936 KB
testcase_11 AC 2,367 ms
29,580 KB
testcase_12 AC 2,979 ms
29,460 KB
testcase_13 AC 2,300 ms
29,516 KB
testcase_14 AC 2,576 ms
29,412 KB
testcase_15 AC 2,350 ms
29,540 KB
testcase_16 AC 173 ms
28,944 KB
testcase_17 AC 1,476 ms
29,468 KB
testcase_18 AC 1,255 ms
29,408 KB
testcase_19 AC 152 ms
29,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
from decimal import *
import numpy as np
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n=II()
    aa=LI()
    bb=LI()
    bb*=2
    friends=[[a,0] for a in aa]
    heapify(friends)
    ans=10**9
    for i in range(n):
        ff=friends.copy()
        mx=0
        for b in bb[i:i+n]:
            a,cnt=heappop(ff)
            heappush(ff,[a+b//2,cnt+1])
            if cnt+1>mx:mx=cnt+1
        ans=min(ans,mx)
    print(ans)

main()
0