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 | 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 | 151 |
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!