Comments

thx.

thx. I just have heard that it can be hacked with one mod without knowing base before. So, how to hack the hashing with 2 bases and mods? Can you teach me?

So the hack needs the code's modulo, base or both?

You're right. I heard of it before.

So must we use hashing with 3 mods?

Maybe. Use hashing with 2 kinds of mod is more important than the time used to solve the problem. I just don't want to write more at that moment (since I have spent too much time on it) and get the FST. :(

It teaches me a lot.

Your words make me not feel alone. :)

It's really sad to get the result that I failed on System Test 32 in D2 using hashing.

I use base=233,mod=998244353 in my hashing. I tried to modify the base or mod, both can get accepted. It seems that the test kills the hashing with base=233,mod=998244353. :(

Anyway D is really a great problem. I was writing a messy code using manacher algorithm in contest before I realized it can be solved with hashing. It takes me a long time.

Sorry for my poor English.

Surreal Number? That's so difficult. :( Bad memory to me, I know little about it until now.

0

Thx. Nice trick!

0

I found some people write a method on B which seems to be O(n log n) with segment tree. like https://mirror.codeforces.com/contest/1192/submission/57854306 I seems to understand how it works. It looks great! But it need the w_i to be positive(or zero). Is there any idea to solve the problem B in O(n log n) when w_i can be negative? Or is there anything wrong with it? If you know, please tell me. thx.