Weird Queries
CodeChefOpen on judge ↗
You are given a list of M positive numbers, A0, A1, ..., AM-1. You have to answer Q queries. Each query has four parameters, l, r, n, k. Given a query with parameters l, r, n, k here is how to compute the answer: - Let (B1, B2 ..., Bd) = (Al, Al+1, ... ,Ar), where d = r-l+1. - Let S = set of all points (x1, x2, ..., xd) in d-dimensional space such that 0 i ≤ Bi. - For x, y ∈ S, define dist(x, y)
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