I used random_device
in order to generate a random number in this code.
On my own Windows, Ubuntu Virtual Machine and WSL, this code can generate different random numbers each time, but on Codeforces it generates the same number every time, so this gives people a way to hack your submission even if xor-hashing is in the formal editorial and the possibility of coincidence in hashing is nearly impossible.
I submitted the same code in C++20 and C++23, got Accepted. So I am wondering that is this problem only for C++17 or just nobody know the number of random_device
in C++20 and C++23, so that they are not able to make a hack.
I suppose this problem should be fixed in order to avoid more solutions being hacked because of unawareness of a fixed 'random' number.
Or any other way to generate random numbers is suggested?
p.s. I tried $$$40000$$$ times on my PC and got all correct.
From the docs:
random_device just is not what you can really rely on.
Better use something like current time as seed.