← All problemsSign in

Recurrence Reachability

CodeChefRating 1759Open on judge ↗

Given two integers $x$ and $y$, where $x \lt y$, we define a function $f_{x, y}$ with the following rules: - $f_{x, y}(0) = x$ - $f_{x, y}(1) = y$ - For every integer $k \ge 2$, $$ f_{x, y}(k) = 3\cdot f_{x, y}(k-1) - 2\cdot f_{x, y}(k-2) $$ You're given two integers $N$ and $M$. Your task is to find any pair of integers $(x, y)$ such that: - $1 \le x \lt y \le N$, and - There exists some integ

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