#K12536. Maximize Crates Delivered to Target Market
Maximize Crates Delivered to Target Market
Maximize Crates Delivered to Target Market
In this problem, you are given information about several crate delivery trips. Each trip is represented by four integers: the starting day, the ending day, the number of crates, and the target market. Your goal is to determine the total number of crates delivered to a specific market, denoted as (d), by selecting the trips that deliver to that market.
Each trip is described by:
(s_i) - the starting day,
(e_i) - the ending day,
(c_i) - the number of crates,
(t_i) - the destination market.
The answer is the sum of all (c_i) for which (t_i = d).
inputFormat
The first line of the input contains three integers (n), (m), and (d) where (n) is the number of trips, (m) is the number of markets, and (d) is the target market.
The next (n) lines each contain four space-separated integers: (s_i), (e_i), (c_i), and (t_i), representing the start day, end day, number of crates, and destination market of each trip.
outputFormat
Output a single integer representing the total number of crates delivered to market (d).## sample
5 3 2
1 3 10 2
2 5 15 1
4 6 20 2
5 9 25 3
7 8 30 2
60