結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-01-02 09:22:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 3,513 ms / 5,000 ms |
コード長 | 1,154 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 44,900 KB |
最終ジャッジ日時 | 2024-11-22 17:44:12 |
合計ジャッジ時間 | 36,318 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
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()