ARC034B
https://gyazo.com/ded8b7332c8236dc32a5b0225d3bbac7
Thoughts.
N is up to 10^18
So f(x) is about 18 x 9 at most
With that many pieces, you could check them all.
Official Explanation OK
---
This page is auto-translated from /nishio/ARC034B using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.