Sereja and Subsegment Increasings
Sereja has an array A that contains n integers: A1, A2, ..., An. Sereja also has an array B that contains n integers B1, B2, ..., Bn. In a single step Sereja can choose two indexes i and j (1 , and increase all the elements of A with indices between i and j inclusively by one, modulo 4. In other words, we make Ap equal to (Ap + 1) modulo 4 if p is an integer from the range [i; j]. Now Sereja is
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.
Sign in to chat with the tutor and save your progress.
Sign in to start