Hack my solution which uses Rolling Hash for Cses problem "Finding Periods"

Правка en2, от Not-Afraid, 2020-05-01 09:36:35

I was solving this problem from CSES. I used modulo $$$2$$$31-1 and was using % operator while calculating hash. It took $$$540ms$$$. Then i tried using unsigned int for calculating hash which implicitly uses modulo $$$2$$$32 if the calculation overflows or underflows and the runtime reduced to 240ms. So, i want to know if i can use my Rolling hash with unsigned int(and is it safe to use) in CF rounds(because i am always afraid of getting hacked while using Rolling Hash).
I uses Rolling Hash more often than string algorithms(if problem can be solved by Rolling hash). Even i use Rolling Hash + binary search to find longest palindromic substring because i don't really understand Manacher's Algorithms.
So, can anyone hack my solution or tell me how much probability this hash has of being hacked during a CF round?

Solution using $$$mod$$$ = $$$2$$$32.
Solution using $$$mod$$$ = $$$2$$$31-1.

Теги rolling hashes

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Not-Afraid 2020-05-01 09:36:35 191 Tiny change: 'p>31</sup> - 1.\n' -> 'p>31</sup>-1.\n' (published)
en1 Английский Not-Afraid 2020-05-01 09:31:25 959 Initial revision (saved to drafts)