← All problemsSign in

Dividing Machine

CodeChefRating 2069Open on judge ↗

Chef has created a special dividing machine that supports the below given operations on an array of positive integers. There are two operations that Chef implemented on the machine. Type 0 Operation Update(L,R): for i = L to R: a[i] = a[i] / LeastPrimeDivisor(a[i]) Type 1 Operation Get(L,R): result = 1 for i = L to R: result = max(result, LeastPrimeDivisor(a[i])) return result; The function

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