結果

問題 No.9 モンスターのレベル上げ
ユーザー Kude
提出日時 2020-09-03 08:01:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,980 KB
実行使用メモリ 193,604 KB
最終ジャッジ日時 2024-11-22 18:10:04
合計ジャッジ時間 40,922 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 2 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    b = b + b
    ans = n
    for s in range(n):
        q = []
        cnt = [0] * n
        for i, ai in enumerate(a):
            heappush(q, (ai, -1, i))
        for j in range(s, s + n):
            ai, _, i = heappop(q)
            cnt[i] += 1
            heappush(q, (ai + b[j] // 2, j, i))
        ans = min(ans, max(cnt))
    print(ans)
solve()
0