← All problemsSign in

K-th Lexicographical Suffix

You are given an integer sequence $a_1, a_2, \ldots, a_N$ and an integer $M$. You should answer $Q$ queries. In each query: - You are given two integers $d$ and $k$. Let's define a modified sequence $b_1, b_2, \ldots, b_N$ as $b_i = (a_i + d) \% M$ for each valid $i$. - Next, for each $i$ ($1 \le i \le N$), let's define the $i$-th suffix of this sequence as the subsequence $b_i, b_{i+1}, \ldots,

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