Chef and Operations
CodeChefOpen on judge ↗
Chef has two sequences $A$ and $B$, each with length $N$. He can apply the following magic operation an arbitrary number of times (including zero): choose an index $i$ ($1 \le i \le N-2$) and add $1$ to $A_i$, $2$ to $A_{i+1}$ and $3$ to $A_{i+2}$, i.e. change $A_i$ to $A_i+1$, $A_{i+1}$ to $A_{i+1}+2$ and $A_{i+2}$ to $A_{i+2}+3$. Chef asks you to tell him if it is possible to obtain sequence $B
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