Problem: https://oj.uz/problem/view/CEOI10_tower

The only upper bound the problem mentions is that N,D \le 1e9. The two pointers intended solution runs in O(N\log N). Is there some implicit bounding, and if so, where? Does the time limit of 1000 ms suggest any bound on N? Please let me know if there are some sly tactics to extract a bound in problems that don’t mention it.