結果

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

ソースコード

diff #

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

min_result = float('inf')

for start in range(n):
    current_A = A.copy()
    used = [False] * n
    count = [0] * n
    
    for i in range(n):
        enemy_idx = (start + i) % n
        enemy_level = B[enemy_idx]
        
        min_level = min(current_A)
        candidates = []
        available = []
        for j in range(n):
            if current_A[j] == min_level:
                candidates.append(j)
                if not used[j]:
                    available.append(j)
        
        if available:
            chosen = min(available)
        else:
            chosen = min(candidates)
        
        count[chosen] += 1
        current_A[chosen] += enemy_level // 2
        used[chosen] = True
    
    current_max = max(count)
    if current_max < min_result:
        min_result = current_max

print(min_result)
0