← All problemsSign in

Count Number of Sequences

CodeChefRating 3325Open on judge ↗

Define $f(x)$ to be the largest divisor of $x$ which is not equal to $x$; in the case of $x = 1$, we define $f(1) = 1$ as an exception. You are given a tree containing $N$ nodes numbered from $1$ to $N$, where each node $i$ has a value $V_i$ assigned to it. Define $g(X, R)$ with $1 \le X, R \le N$ as the number of arrays of nodes $A$ that satisfy the following conditions: - $1 \le A_i \le N$ (i.e

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