Hi, can anyone share a solution to IOI 2014 Rail? I checked the official solution (http://www.ioinformatics.org/locations/ioi14/contest/day1/rail/rail-solution.pdf), but it does not specify how to handle each case, it only mentions them.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi, can anyone share a solution to IOI 2014 Rail? I checked the official solution (http://www.ioinformatics.org/locations/ioi14/contest/day1/rail/rail-solution.pdf), but it does not specify how to handle each case, it only mentions them.
Название |
---|
http://www.ioinformatics.org/locations/ioi14/contest/day1/rail/rail-solution.pdf
That's the link I posted. As you can see, it doesn't explain in detail how to handle each case...
Why downvotes ? It's true that the official solution isn't explained in lots of details.
The only other link I can give you is Bruce Merry's blog. It is pretty cool, but you'll need to be concentrated because he also doesn't give lots of details (though he explains everything you need).
If you're completely stuck, you can PM me and I'll send you an AC code.
But try to do it by yourself first :D
Thanks for the response!
I have already seen Bruce Merry's post, but I stumbled upon his first observation:
1. d(X, Y) < d(X, 0): these are reached directly from station X and of type C,
so we can locate them exactly. (where X is the station closest to 0)
Say we have for example the following railway (0)CCCCCCCCD(X)D(Y). d(X, Y) < d(X, 0), but Y is of type D, and cannot be reached directly from X.
Is there anything i am missing here?
Actually, you don't have d(X, Y) < d(X, 0). In your case, d(X, Y) = d(X, 0) + d(0, Y) > d(X, 0)
Did you understand well how the distances are defined ?
These aren't the physical distances but rather the railway distances.
So, here, d(0, Y) < d(X, Y) while X and Y are adjacent on your scheme.
Read the statement again, I think you misunderstood it.
EDIT: this is actually false, check my other message :-)
I don't think the formula d(X, Y) = d(X, 0) + d(0, Y) is correct in this case. I mean, If you want to go from Y to X, you don't have to move to point 0 to turn, there are other C stations closer to Y:
(0)CCCCCCCC(Z)D(X)D(Y)
d(X, Y) = d(X, Z) + d(Z, Y)You are completely right :D
I answered without reading my code and I had forgotten this.
I think that bmerry is wrong for that point. In fact, I didn't get AC the first time I submitted, and it was because I processed wrongly these railways.
So, well done, you understood the question perfectly ^^
Anyway, I marked these points as "left" and I used them like the other points at the left of X (so, strangely, I consider your Y as a "left" station !)
Then, the technique explained by bmerry works well (checking if C are at the right place or not), so you should use it, and you should get a wonderful 100 / 100 !
Thank you very much!