結果

問題 No.9 モンスターのレベル上げ
ユーザー lam6er
提出日時 2025-03-20 20:18:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,111 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 53,248 KB
最終ジャッジ日時 2025-03-20 20:20:16
合計ジャッジ時間 7,306 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    idx = 0
    N = int(data[idx])
    idx += 1
    A = list(map(int, data[idx:idx+N]))
    idx += N
    B = list(map(int, data[idx:idx+N]))
    
    min_max_usage = float('inf')
    
    for start in range(N):
        current_levels = A.copy()
        usage = [0] * N
        
        for j in range(N):
            enemy_pos = (start + j) % N
            enemy_level = B[enemy_pos]
            
            # Find the monster with the minimum level and smallest index
            min_level = current_levels[0]
            min_idx = 0
            for i in range(1, N):
                if current_levels[i] < min_level:
                    min_level = current_levels[i]
                    min_idx = i
            
            # Update usage and level
            usage[min_idx] += 1
            current_levels[min_idx] += enemy_level // 2
        
        current_max = max(usage)
        if current_max < min_max_usage:
            min_max_usage = current_max
    
    print(min_max_usage)

if __name__ == "__main__":
    main()
0