結果

問題 No.9 モンスターのレベル上げ
ユーザー vwxyzvwxyz
提出日時 2021-06-27 18:00:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,642 ms / 5,000 ms
コード長 1,006 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 116,964 KB
最終ジャッジ日時 2023-09-07 18:07:00
合計ジャッジ時間 20,190 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 267 ms
91,508 KB
testcase_01 AC 268 ms
91,472 KB
testcase_02 AC 1,642 ms
116,964 KB
testcase_03 AC 1,433 ms
111,704 KB
testcase_04 AC 911 ms
101,876 KB
testcase_05 AC 718 ms
99,596 KB
testcase_06 AC 504 ms
96,808 KB
testcase_07 AC 327 ms
95,780 KB
testcase_08 AC 552 ms
98,160 KB
testcase_09 AC 1,599 ms
115,992 KB
testcase_10 AC 261 ms
91,728 KB
testcase_11 AC 1,240 ms
108,568 KB
testcase_12 AC 1,315 ms
107,736 KB
testcase_13 AC 1,180 ms
107,428 KB
testcase_14 AC 1,620 ms
116,472 KB
testcase_15 AC 1,505 ms
113,464 KB
testcase_16 AC 366 ms
96,440 KB
testcase_17 AC 1,112 ms
105,796 KB
testcase_18 AC 990 ms
103,860 KB
testcase_19 AC 355 ms
95,928 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())
B=list(map(int,readline().split()))
A=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(BB)
    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