Hello, since gym doesn't allow to see others solutions could someone help with this problem:
i have tried this solution but got WA
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3611 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 161 |
| 2 | adamant | 150 |
| 3 | Um_nik | 146 |
| 4 | Dominater069 | 144 |
| 5 | errorgorn | 141 |
| 6 | cry | 139 |
| 7 | Proof_by_QED | 136 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 9 | TheScrasse | 134 |
Hello, since gym doesn't allow to see others solutions could someone help with this problem:
i have tried this solution but got WA
| Name |
|---|



You actually don't need DP to solve this problem.
Think of it like this, Bus Stops means that you have segments in the form $$$(li, ri)$$$. In these segments you don't need to walk.
This means that if consecutive segments (let's say $$$(li, ri)$$$ & $$$(lj, rj)$$$ assuming $$$ri \lt =lj$$$ and $$$rj \gt =ri$$$) are intersecting you don't need to walk in the segment $$$(li, rj)$$$ at all.
So now this problem becomes for the distance (1, n) how many places have no segments. That is the answer. For merging segments you can sort and merge, I think it's pretty well known.
thx, appreciate that!