結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:43:08 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 882 bytes |
コンパイル時間 | 229 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 52,096 KB |
最終ジャッジ日時 | 2025-06-12 20:43:27 |
合計ジャッジ時間 | 6,774 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 17 |
ソースコード
n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) min_max = float('inf') for k in range(n): enemy_order = [B[(k + i) % n] for i in range(n)] a = A.copy() fight_counts = [0] * n for b in enemy_order: min_level = min(a) candidates = [i for i in range(n) if a[i] == min_level] possible = [i for i in candidates if fight_counts[i] == 0] if possible: chosen = min(possible) else: min_fight = min(fight_counts[i] for i in candidates) possible = [i for i in candidates if fight_counts[i] == min_fight] chosen = min(possible) exp = b // 2 a[chosen] += exp fight_counts[chosen] += 1 current_max = max(fight_counts) if current_max < min_max: min_max = current_max print(min_max)