11092 - IIUC HexWorld
Posted: Fri Aug 31, 2007 12:00 pm
I have AC this problem, but I am not satisfied with my solution. Time 0.879, memory 30400.
Distance of Alice is easy, just abs(A-B). For distance of Bob, I precalculated x and y coordinate and some addition variables for every cell, but I remember only every 10th cell, for avoiding of MLE. Then, for A and B, I made additional computation to find out x and y coordinate for A and B and then write as result sqrt(sqr(xA-xB)+sqr(yA-yB)).
As I can see, most of solutions are accepted in minimum memory and very good time (the best is 0.002). Any idea for easy solution of Bob distance, without precalculation?
Thanks in advance!
Please sorry for my bad english.
Distance of Alice is easy, just abs(A-B). For distance of Bob, I precalculated x and y coordinate and some addition variables for every cell, but I remember only every 10th cell, for avoiding of MLE. Then, for A and B, I made additional computation to find out x and y coordinate for A and B and then write as result sqrt(sqr(xA-xB)+sqr(yA-yB)).
As I can see, most of solutions are accepted in minimum memory and very good time (the best is 0.002). Any idea for easy solution of Bob distance, without precalculation?
Thanks in advance!
Please sorry for my bad english.