Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Problem with C++ compilers of Codeforces

Правка en1, от xiaruize, 2024-09-22 17:43:23

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 to be hacked because of unawareness of a fixed 'random' number.

Or any other way to generate random numbers is suggested?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский xiaruize 2024-09-22 17:46:46 66 (published)
en1 Английский xiaruize 2024-09-22 17:43:23 1074 Initial revision (saved to drafts)