Crossbow
CodeChefOpen on judge ↗
You are given an integer $D$. Find an integer sequence $A1,A2,…,AN$ such that the following conditions are satisfied: - $1≤N≤105$ - $1≤Ai≤105$ for each valid $i$ - $∑Ni=1∑Nj=i(min(Ai,Ai+1,…,Aj)−GCD(Ai,Ai+1,…,Aj))=D$ It can be proved that a solution always exists under the given constraints. Note: $GCD(B1,B2,…,BM)$ is the greatest integer which divides all the integers $B1,B2,…,BM$. #Input - Th
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