Блог пользователя VOI27

Автор VOI27, история, 4 часа назад, По-английски

As far as I know, hashing is a powerful tool to compare two strings in O(1) but it has an error rate; especially in online contests, where I saw so many submissions were hacked because of it. Therefore, I have some questions:

  1. Should I use hashing in online contests, or it is only good for offline competitions? And if yes, how should I use it to both meet the time limit and make it difficult to hack?
  2. Are there any alternatives to hashing which can't be hacked that run in O(1) or O(log(n))?

I appreciate your time reading and answering my questions.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 часа назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It's definitely viable in online competitions, and is difficult to hack if you use a randomized base and a large enough modulo/multiple moduli, see https://usaco.guide/gold/hashing