Emsawy's blog

By Emsawy, history, 9 years ago, In English

559B - Equivalent Strings what is causing Time Limit ? - And what is the best solution to avoid TL ? - solution http://codeforces.net/contest/559/submission/13479349

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

ur doing it in o(n2)

well there is a solution like urs that the only difference is u can find if two strings are the same with hash

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I reads about hash but i can`t understand the relation between hash and the problem . but , I used the array of char instead of strings and get AC http://codeforces.net/contest/559/submission/13719791

    could you illustrate the relation between hash and the problem and send me your code for it .

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      well if tow strings are equal then their hash is equal ! and as hash is only a number u can check it in O(1)