Smaller Ones Before Me
For each position, print how many EARLIER elements are strictly smaller than it.
Input: the first line has N; the second line has N integers.
Output: N integers: the count of smaller predecessors per position.
Constraints:
- 1 ≤ N ≤ 105
- |ai| ≤ 109
Sample Tests
Input 1
5 3 1 4 1 5
Output 1
0 0 2 0 4
Input 2
2 2 2
Output 2
0 0
Discussion (opens after you solve — no spoilers before)
No comments yet.