結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:23:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 877 bytes |
| コンパイル時間 | 212 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 86,312 KB |
| 最終ジャッジ日時 | 2025-03-31 17:24:25 |
| 合計ジャッジ時間 | 6,851 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 17 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
best = float('inf')
for k in range(n):
rotated_B = B[k:] + B[:k]
current_A = A.copy()
selected = [0] * n
current_min = min(current_A)
for b in rotated_B:
candidates = []
for i in range(n):
if current_A[i] == current_min:
candidates.append(i)
unselected = [i for i in candidates if selected[i] == 0]
if unselected:
chosen = min(unselected)
else:
chosen = min(candidates)
selected[chosen] += 1
add = b // 2
current_A[chosen] += add
old_level = current_A[chosen] - add
if old_level == current_min:
current_min = min(current_A)
current_max = max(selected)
if current_max < best:
best = current_max
print(best)
lam6er