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

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

Автор gagannagpal68, история, 5 лет назад, По-английски

My hash has 3 fields

f1 = size of interval

f2 = sum of array elements over interval(a[i] +a[i+1]...a[j])

f2 = sum of squares of array elements over interval(a[i]^2 + a[i+1]^2 .. a[j]^2).

if all 3 matches, then elements are indeed same. Can this be broken?

P.S. While in attempt to solve D from previous contest(https://codeforces.net/contest/1284/problem/D). I was looking for this question.

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

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

Auto comment: topic has been updated by gagannagpal68 (previous revision, new revision, compare).

»
5 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

(5, 12, 10) and (6, 8, 13) have the same hash.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится -20 Проголосовать: не нравится

    I think adding a cube power may make this hash a perfect hash.

    • »
      »
      »
      5 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      Sorry to disappoint you, but probably not. It can be shown by a simple Dirichlet. There are a lot more arrays of size 1000 than there are possible outputs for your hash if you bound the numbers by let's say 1000.

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        On a contest, lets say we choose 3 random powers.

        I guess that would be optimistically a good hash?

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      It will be perfect only if you consider at least $$$n$$$ distinct powers.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Adding powers up to k can easily be hacked with a test with n=2^(k+2).