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 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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 |
---|
Auto comment: topic has been updated by Makaty (previous revision, new revision, compare).
instructions unclear: solution page not able to be viewed please send your code in a code block instead
hello, sorry for that :), here is my code:
2 declarations of $$$t$$$? One as an array and another as an input integer? Looks more like Compile Error than WA to me...
yeah i see, but unfortunately it wasn't compile error, when i used
t
in main the compiler took the block scope one instead of the global var so it workedYou 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<=lj$$$ and $$$rj>=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!