POJ 2991 Crane

Uses Ant Book's solution: segment tree.