← All problemsSign in

Chef and Prime Queries

CodeChefRating 2138Open on judge ↗

Chef likes solving problems involving a lot of queries with prime numbers. One day, he found a new problem which is difficult for him to solve. So, he needs your help to solve it. Given an array a of N integers and Q queries where each query provides you with four integers L, R, X and Y. For each query, output the value of F(L, R, X, Y) as defined below. F(L, R, X, Y) { result := 0 for( i = X

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