結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2021-06-27 18:00:22 |
言語 | PyPy3 (7.3.8) |
結果 |
AC
|
実行時間 | 1,610 ms / 5,000 ms |
コード長 | 1,006 bytes |
コンパイル時間 | 272 ms |
使用メモリ | 123,556 KB |
最終ジャッジ日時 | 2023-01-23 15:54:22 |
合計ジャッジ時間 | 19,946 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 290 ms
100,568 KB |
testcase_01 | AC | 287 ms
100,684 KB |
testcase_02 | AC | 1,608 ms
122,876 KB |
testcase_03 | AC | 1,416 ms
118,044 KB |
testcase_04 | AC | 912 ms
108,408 KB |
testcase_05 | AC | 753 ms
106,432 KB |
testcase_06 | AC | 532 ms
103,596 KB |
testcase_07 | AC | 348 ms
102,348 KB |
testcase_08 | AC | 568 ms
103,996 KB |
testcase_09 | AC | 1,607 ms
122,532 KB |
testcase_10 | AC | 282 ms
100,580 KB |
testcase_11 | AC | 1,234 ms
113,696 KB |
testcase_12 | AC | 1,183 ms
113,380 KB |
testcase_13 | AC | 1,174 ms
113,516 KB |
testcase_14 | AC | 1,610 ms
123,556 KB |
testcase_15 | AC | 1,481 ms
120,028 KB |
testcase_16 | AC | 392 ms
102,596 KB |
testcase_17 | AC | 1,107 ms
112,316 KB |
testcase_18 | AC | 1,019 ms
110,316 KB |
testcase_19 | AC | 376 ms
102,780 KB |
ソースコード
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)