Huge GCD
CodeChefOpen on judge ↗
You are given N prime numbers. You have to support Q queries, each of which is one of these : - 1 i x : Update the ith element to x, where x is also a prime. - 2 L R : Let S be the set of primes currently in range [L,R]. You need to first find X = product of all primes in set S and then find gcd(X, phi(X)) modulo 10^9 + 7. Note that a set only contains distinct elements, and that phi(X) is the 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.
Sign in to chat with the tutor and save your progress.
Sign in to start