← All problemsSign in

Chef and odd queries

CodeChefRating 2573Open on judge ↗

Chef has N segments. For each i (1 ≤ i ≤ N), the i-th segment starts at point Li and ends at point Ri (let's denote it by [Li,  Ri]). Let's say that a segment [l, r] crosses a point x if l ≤ x ≤ r. Chef wants you to answer Q queries. In each query, you are given a set of M distinct points X1, X2, ..., XM; you should compute the number of good segments [Li, Ri] among the given N segments. A segme

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