結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:12:22 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,406 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 86,444 KB |
最終ジャッジ日時 | 2025-04-15 22:13:44 |
合計ジャッジ時間 | 6,731 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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): current_A = A.copy() used = [False] * n count = [0] * n for i in range(n): pos = (start + i) % n b = B[pos] # Find the minimum level min_level = min(current_A) # Collect all candidates with min_level candidates = [] for idx in range(n): if current_A[idx] == min_level: candidates.append(idx) # Find available candidates (not used) available = [] for idx in candidates: if not used[idx]: available.append(idx) if available: selected = available[0] else: selected = candidates[0] count[selected] += 1 current_A[selected] += b // 2 used[selected] = True current_max = max(count) if current_max < min_max: min_max = current_max if min_max == 1: break # Can't get better than 1 print(min_max) if __name__ == "__main__": main()