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.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | nor | 157 |
4 | atcoder_official | 156 |
4 | cry | 156 |
6 | -is-this-fft- | 155 |
7 | maroonrk | 154 |
8 | adamant | 153 |
9 | Um_nik | 151 |
10 | djm03178 | 146 |
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.
Name |
---|
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!