← All problemsSign in

Little Elephant and CNSes

CodeChefRating 2929Open on judge ↗

A Little Elephant from the Zoo of Lviv likes lucky strings, i.e., the strings that consist only of the lucky digits 4 and 7. The Little Elephant has N favorite strings S1, S2, ..., SN and the favorite number K. Each character in Si (1 ≤ i ≤ N) is either the lucky digit (4 or 7) or the question mark ?. Consider some non-decreasing lucky string S. In other words, S has one of the following forms:

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