← All problemsSign in

A Game of Primes

CodeChefRating 2480Open on judge ↗

Given an empty array **A** of infinite length and a positive integer **K** you have to process **Q** queries of type: - **! l r x**: Fill the value **x** in all the **empty places** in the array from index **l** to **r** (both inclusive). - **? l r**: Print the number of prime factors of **K** which is also a prime factor of *at least* one number in *A[l], A[l + 1], A[l + 2], … A[r]*. ##

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