Three Dim Order Count Problem

Three Dim Order Count Problem — ExecCode Hard DSA Practice

Solve the Three Dim Order Count problem on ExecCode. Free online hard DSA practice in Searching & Sorting. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Count ordered pairs of distinct points (p, q) such that p is strictly less than q in every coordinate. The n log^2 n contest method is CDQ divide-and-conquer (or a 2D Fenwick after sorting x). Parallel binary search appears when each point has a time threshold. Bitsets accelerate dominance for tiny coordinates. Meet-in-the-middle is the exponential cousin when n is tiny and the state is a subset. Randomized hashing is not required for deterministic 3D counting. Return the number of dominating pairs. Equal coordinates do not count. You are given: points — list of [x, y, z] integers Return number of strict 3D dominance pairs. The pair (i, j) is ordered: if both directions dominate, both are counted. Ties in any axis skip that ordered pair.

Examples

Input {'points': [[1, 1, 1], [2, 2, 2], [3, 0, 3]]}; Output 1. Input {'points': [[0, 0, 0]]}; Output 0. Input {'points': [[1, 2, 3], [4, 5, 6], [0, 9, 9]]}; Output 1

Constraints

Points may repeat Coordinates may be zero n = 0 returns 0

Practice Three Dim Order Count free on ExecCode. Browse DSA problems, topic map, and placement guides.