← All problemsSign in

Stringology is Magic

CodeChefRating 2769Open on judge ↗

You have been given a string T with n lowercase letters T[1..n]. For each substrings T[l..r], we can assign them two values, k1 and k2, which are defined as following. - k1 is the number of different substrings which are lexicographically smaller than T[l..r]. There are (n + 1) * n / 2 substrings in total. - k2 indicates the number of substrings which are as same as T[l..r] but have smaller le

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start