Hi, everyone! :)
As you know from 13th to 20th of January The International Olympiad in Informatics, Physics and Mathematics named after Orymbek Zhautykov(hope I wrote the name correctly) will be held in Kazakhstan, Almaty.
I think that is a bit unfortunate that organisers do not post the official solutions or at least hints for the problems. I was unsuccessful in finding the test data and statements for problems too for a while. Luckily, the tasks and test data of the previous IZHO were published here. If anyone knows solutions for problems, you can help others by sharing your knowledge here.
Have fun! :)
*Regarding the first problem of DAY1 I had a solution that computed the change in x and y coordinates for Gorlum and tried to simulate the process in O(1) by adding Dx to x and Dy to y coordinates. I was also identifying whether the Gorlum converges or diverges the Laser. So there are basically three cases:
1) After going through the string of commands Gorlum returns to the position where he started. In this case, we just have to simulate the string once and find the max and min distances observed.
2) Gorlum converges the Laser. Here we just have to add dx and dy change values to our current coordinates and wait till it starts to diverge from the Laser. actually on that intersection of Gorlum and Laser we can find the nearest point.
3) Gorlum diverges from the Laser. Here we can again simulate the process and look for maximum distance.
*Note: I also simulate the last and first cycles fully because there can be the answers for the farthest and nearest points.
Here is my code.
This was my solution for this problem. However, it seems incorrect. And now I don't have an idea that would fit in time. If anyone knows the solution I would be grateful if you shared. :)
Full text and comments »