← All problemsSign in

Chef and Prefixes

CodeChefRating 3447Open on judge ↗

Chef's favorite part of a string is its prefix (which might also be the whole string). Let $S[1:k]$ denote the prefix of $S$ of length $k$. Chef decided to give you $N$ strings $S_1, S_2, \ldots, S_N$. The $i$-th string has value $A_i$, initially equal to $0$. He then gives you $Q$ queries, each query is one of the following: - `1 i K x` Suppose the current number of strings is $M$. For e

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