← All problemsSign in

Agent Sly Fox And Queries

Sly Fox has been tipped about a train containing explosives by an informer. The compartments of the train are numbered as 1,2,.....n and the amount of explosive in each compartment is given as an array A1,A2,…..An of integers. He also gives him M queries of the form Li, Ri. For each query , Sly Fox has to find how many times the largest element of the sub-array A[ Li, Ri ] occurs in A[ Li, Ri ]. A

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