結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:08:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,284 bytes |
コンパイル時間 | 348 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 85,620 KB |
最終ジャッジ日時 | 2025-06-12 18:10:43 |
合計ジャッジ時間 | 6,822 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 17 |
ソースコード
import sys def main(): N = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) B = list(map(int, sys.stdin.readline().split())) min_max = float('inf') for start in range(N): enemy_order = B[start:] + B[:start] current_levels = A.copy() selected = [False] * N counts = [0] * N for b in enemy_order: m = min(current_levels) selected_i = -1 # Check unselected monsters first for i in range(N): if not selected[i] and current_levels[i] == m: selected_i = i break # If no unselected found, check all if selected_i == -1: for i in range(N): if current_levels[i] == m: selected_i = i break counts[selected_i] += 1 selected[selected_i] = True current_levels[selected_i] += b // 2 current_max = max(counts) if current_max < min_max: min_max = current_max # Early exit if possible if min_max == 1: break print(min_max) if __name__ == "__main__": main()