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

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

I am getting a WA on testCase 6.

Question — Div 2C

My Submission

Can someone please tell me what's wrong with the code?

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Ok.

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

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

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

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

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

I changed s[j] to c(to fix the logic at your code) and get WA at test 16 instead. 25885244

I think there is hash collision which cause this to still fail. So either use a better hash function or don't hash! :)

UPD: The problem do lies in the hashing. I simply change the hash function and now the answer is wrong on another line

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Your function returns this same hash for strings "af" and "ba"... Seems like it isn't very good... Try changing 5 for something bigger, it should help (bigger than 26). I haven't look for other bugs, so I am not sure that it will help.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

You can get rid of hashing by replacing set<ll> with set<string> and still get WA 6: 25894661. It means that your solution has some other problems. I'd recommend finding them first, getting TL, and add hashing only afterawards.

Also, as far as I can see, your hashing function is just fine.

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

1 1
ab
ab
should be no, but your code says yes.