Company: Titan_16sep
Difficulty: medium
Segment Trouble Problem Description You are given N segments. Each segment has three characteristic properties (L,R,cost). This means that the segment starts from 'L', extends up to 'R', and has some 'cost'. Endpoints 'L' and 'R' are included in the segment. Two segments can form a valid pair, if and only if those two segments do not overlap. Segments are called overlapping if there is at least one point 'x' lying in both the segments. The cost of the pairing of two valid segments is defined as the product of their individual costs. Out of all possible valid pairs, find the valid pair of segments, for which their cost of pairing is minimal. Print that min cost of pairing. Input Format The first line will contain a single integer N, denoting the number of segments. Then, the next line shall contain an integer, which will always be 3. Then, N lines follow, where each line shall contain three space-separated integers (L,R,cost) Output Format Print a single integer in a single line, the an