mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 22:57:50 +03:00
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. |
||
|---|---|---|
| .. | ||
| Epub | ||
| Epub.cpp | ||
| Epub.h | ||