LCM Constraints
You are given $M$ triplets $(X_1, Y_1, B_1), (X_2, Y_2, B_2), \ldots, (X_M, Y_M, B_M)$. Find the number of sequences of positive integers $A_1, A_2, \ldots, A_N$ such that for each valid $i$, $\mathrm{lcm}(A_{X_i},A_{Y_i}) = B_i$, or determine that there is an infinite number of such sequences. Since the answer can be very large, compute it modulo $1,000,000,007$ ($10^9 + 7$). Note that the val
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