結果

問題 No.9 モンスターのレベル上げ
ユーザー こる
提出日時 2017-01-06 17:43:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 844 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 61,696 KB
最終ジャッジ日時 2024-12-17 14:36:29
合計ジャッジ時間 78,436 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 RE * 2 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import copy
from operator import itemgetter
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
a.sort()
def fun(index):
    array_p=copy.deepcopy(a)
    array=[[i,0] for i in array_p]
    if index==n:
        return math.inf

    for i in range(index,len(b)+index):
        array.sort(key=itemgetter(0))
        j=0
        mini=array[j][1]
        a_index=j
        while array[j][0]==array[j+1][0] and j<n-1:
            if array[j][1]>array[j+1][1]:
                mini=array[j+1][1]
                a_index=j+1
            j+=1
        j=a_index
        #print("array=",array)
        #print("a_index=",a_index)
        array[j][0]+=int(b[i%n]/2)
        array[j][1]+=1

    ret=max(array,key=itemgetter(1))[1]
    #print(index)
    #print(ret)
    return min(ret,fun(index+1))
print(fun(0))
0