I used prefix sums in 3rd one which fortunately worked out(AC) and thought something for 2nd which turned out to be wrong(WA) So, how do we determine who wins the game in 2nd problem ?
Edit:- Realized the basic xor nim was the answer for the 2nd problem which I completely ignored , but it is not that easy/straightforward as mentioned by
For the 2nd problem, bruteforce grundy nimbers for small piles (that’s what I did), and notice that grundy(n) = n - 1. Then take xor of nimbers of all piles.
Thanks
Also, in the third problem, I think, setter should have mentioned something like:-
"Don’t worry, all calculations will give integer or .5 values , cuz area can be anything like float,etc… after doing so many area calculations, the final area might not be an integer…also…that modulo 1e9+7 is annoying, its not needed at all, as 10^18 is the max area possible…
I think the 2nd question can be solved by counting how many of the numbers are greater than 1.
And if count is even 2 wins, else 1 wins. Is it correct?
I did the calculation without mod, and just put mod in the final line and it gives AC, so the area is in range 10^18, cuz just take a square with extreme co-ordinates like (1,1)…bottom left and , and (10^9,10^9)…top right…now find the area,it gives 10^18…
I simply wrote 1 3 4 and realized why the intuition thing is not correct cuz the second guy can do things which are much better and optimal and he can actually win, so in 2-3 minutes, I was sure that this is wrong and xor should be the way to go. But then I saw the polygon problem and went there because things were more straightforward there , but calculation was a bit more.(also haven’t touched game theory in a long time as its not asked often maybe)
I didn`t knew anything about how to approach problems in game theory, just saw these videos during the contest, got an intuition and coded it and it got accepted, pretty fantastic feeling