Hi Codeforces,

I hope you enjoyed the contest despite the difficulty. Do not hesitate to ask questions and discuss the problems here. :)

If you participated, I would really appreciate if you could fill in this short form. It only takes 1 minute and will be useful for my thesis. https://goo.gl/forms/XPfkoRxRjEKmTDt32

Editorial: https://vlecomte.github.io/set/geo18/editorial.pdf

Example solutions:

- A: https://pastebin.com/kr3jc1qZ
- B: https://pastebin.com/mhz6J0bW
- C: https://pastebin.com/JMdQg4Dr
- D: https://pastebin.com/bQUTXGG8

You can also download all solutions/generators/checkers/validators here: https://vlecomte.github.io/set/

Thanks to all who participated! :)

It seems that I approached B in more geometrical rather than formulae way. I reduced this problem to such one:

We are given two lines k, l in 2D rotating with equal speed around some points A, B (possibly in different directions). There is also third line m. Print first time when k, l meet on m.

Assume that they rotate in same direction. Then oriented angle they form is constant, so locus of their intersection is circle containing A, B and an their point of intersection in an arbitrary time (I chose this moment to be 123 to avoid case when this point coincides with A or B). We need to intersect this circle with m and we get at most two candidates for a meeting point and we can choose best one. If they rotate in different directions we can reflect k and A with respect to m and reduce problem to first case.

Always a satisfying thing to crack an involved geo problem :D.

(Btw I forgot to set my alarm and I woke up at 11:30AM and contest was going on from 10AM :().

Woah, I love that approach! Indeed, when I saw your submission I really wondered what was going on there. :)

Too bad, I used

taninstead ofcotand didn't check if the answer is π / 2.I got wa 27 because of epsilons and expected all such stupid bugs to fail before that. :(