Link to the problem: https://codeforces.me/contest/741/problem/D
I came up with a solution using Small To Large and Xor Hashing, but my time complexity is $$$O(n*log^2(n)*26)$$$, which is still not optimized enough. It got the extra $$$log$$$ from using map
, and I'm not sure of how to get rid of the map
. Can someone help me pls?
EDIT: Got rid of the map
, not sure how to explain it tho. And the solution above would've WAed test 32 because i forgot to make the default value of the map to be -INF
Accepted solution: https://codeforces.me/contest/741/submission/287930415