Eunchurn Park d3848779f9
fix(parser): handle oversized words in line break algorithm
When a word exceeds the page width, the DP algorithm would leave
dp[i] = MAX_COST, causing a cascade failure where all preceding
words also got MAX_COST. This resulted in each word being placed
on its own line.

Fix: When dp[i] remains MAX_COST after the inner loop, force the
oversized word onto its own line (ans[i] = i) and inherit the cost
from the next word (dp[i] = dp[i+1]) to allow preceding words to
find valid configurations.
2025-12-27 15:41:14 +09:00
..