How to solve today's C problem if alphabet is not $$$26$$$ characters but rather $$$O(n)$$$? I could only come up with simple $$$O(q \sqrt n)$$$ using basic MO algorithm. Any ideas?
Harder version of today's Div.3C
How to solve today's C problem if alphabet is not $$$26$$$ characters but rather $$$O(n)$$$? I could only come up with simple $$$O(q \sqrt n)$$$ using basic MO algorithm. Any ideas?