結果

問題 No.9 モンスターのレベル上げ
ユーザー vwxyzvwxyz
提出日時 2021-06-27 17:41:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 120,464 KB
最終ジャッジ日時 2023-09-07 18:06:08
合計ジャッジ時間 22,621 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
91,716 KB
testcase_01 AC 257 ms
91,460 KB
testcase_02 AC 1,901 ms
120,464 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 507 ms
97,060 KB
testcase_07 AC 321 ms
95,744 KB
testcase_08 AC 552 ms
98,216 KB
testcase_09 AC 1,819 ms
119,304 KB
testcase_10 AC 259 ms
91,700 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1,318 ms
108,136 KB
testcase_14 AC 1,865 ms
118,316 KB
testcase_15 AC 1,721 ms
116,416 KB
testcase_16 WA -
testcase_17 AC 1,249 ms
107,772 KB
testcase_18 AC 1,080 ms
103,888 KB
testcase_19 AC 336 ms
95,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
from collections import Counter, deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N=int(readline())
A=list(map(int,readline().split()))
B=list(map(int,readline().split()))
ans=float('inf')
for d in range(N):
    AA=[A[(i+d)%N] for i in range(N)]
    BB=[(B[i],0) for i in range(N)]
    heapify(B)
    for a in AA:
        b,c=heappop(BB)
        heappush(BB,(b+a//2,c+1))
    ans=min(ans,max(BB[i][1] for i in range(N)))
print(ans)
0