#K2136. Maximum Treasures Collection
Maximum Treasures Collection
Maximum Treasures Collection
You are given N trail parts. Each part is described by three integers: A, B, and T, where A and B denote the start and end points of that trail segment, and T denotes the number of treasures present in that segment.
Your task is to determine the maximum number of treasures that can be collected by traversing all the trail parts. In this problem, the maximum number of treasures is simply the sum of treasures across all segments. Mathematically, you need to compute:
[ Total_Treasures = \sum_{i=1}^{N} T_i ]
Note: Even though the trail parts may have ordering details (A to B), the solution only requires summing up the treasures from all the parts.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer N (0 \(\le\) N \(\le\) 105), representing the number of trail parts.
- Each of the following N lines contains three space-separated integers: A, B, and T.
Here, A and B represent the start and end points of a trail segment, and T represents the number of treasures in that segment.
outputFormat
Output to standard output (stdout) a single integer - the maximum total number of treasures collected from all trail parts.
## sample1
1 2 10
10