Hello, I am one of the participants of APIO 2025 (you can check at rank 44). The problems are really hard and tricky, and one of them is the 3rd problem — rotate. You guys can check the statements of APIO2025 in here: https://github.com/apio2025/apio2025_tasks.↵
↵
I won't talk about the statement of the 3rd problem here since it's already in github; you guys should check that before reading my solution.↵
↵
So, I don't know if this is the intended solution, but I think I am **really lucky** when I got accepted at 4h45. And that solution is **really simple**. Here's my solution:↵
↵
<spoiler summary="Solution">↵
Without loss of generality, suppose the array $v$ is sorted in ascending order. Then for all $i$ from $0$ to $\left \lfloor \frac{n}2\right \rfloor-1$, I'll update $v_{i+\left \lfloor \frac{n}2\right \rfloor}=(v_i+25000)\ mod\ 50000$ (the idea of this solution is to make the rods symmetric, because I found out that when symmetric, the solution is optimal).↵
</spoiler>↵
↵
<spoiler summary="Code">↵
I don't think I will show the code since it's really easy to implement, and my code is **only 16 lines long**.↵
</spoiler>↵
↵
I can't prove my solution, so can you guys check this and prove it for me, or is this solution wrong?↵
↵
Thank you for reading this blog.
↵
I won't talk about the statement of the 3rd problem here since it's already in github; you guys should check that before reading my solution.↵
↵
So, I don't know if this is the intended solution, but I think I am **really lucky** when I got accepted at 4h45. And that solution is **really simple**. Here's my solution:↵
↵
<spoiler summary="Solution">↵
Without loss of generality, suppose the array $v$ is sorted in ascending order. Then for all $i$ from $0$ to $\left \lfloor \frac{n}2\right \rfloor-1$, I'll update $v_{i+\left \lfloor \frac{n}2\right \rfloor}=(v_i+25000)\ mod\ 50000$ (the idea of this solution is to make the rods symmetric, because I found out that when symmetric, the solution is optimal).↵
</spoiler>↵
↵
<spoiler summary="Code">↵
I don't think I will show the code since it's really easy to implement, and my code is **only 16 lines long**.↵
</spoiler>↵
↵
I can't prove my solution, so can you guys check this and prove it for me, or is this solution wrong?↵
↵
Thank you for reading this blog.



