結果

問題 No.9 モンスターのレベル上げ
ユーザー gew1fw
提出日時 2025-06-12 12:54:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 910 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2025-06-12 12:58:27
合計ジャッジ時間 7,138 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

min_max = float('inf')

for k in range(n):
    order = B[k:] + B[:k]
    state = [[a, 0] for a in A]
    max_count = 0
    for b in order:
        min_level = min(s[0] for s in state)
        candidates = [i for i in range(n) if state[i][0] == min_level]
        zero_selected = [i for i in candidates if state[i][1] == 0]
        if zero_selected:
            selected = min(zero_selected)
        else:
            min_cnt = min(state[i][1] for i in candidates)
            min_cnt_candidates = [i for i in candidates if state[i][1] == min_cnt]
            selected = min(min_cnt_candidates)
        state[selected][0] += b // 2
        state[selected][1] += 1
        if state[selected][1] > max_count:
            max_count = state[selected][1]
    if max_count < min_max:
        min_max = max_count

print(min_max)
0