Task There are n informational Olympiads you can participate in. For each Olympiad, you know the start and end dates and
Posted: Wed Apr 27, 2022 5:00 pm
c++ programing
use dynamic programming. the perfect algorithm;s this complexity
is O(n logn)
Task There are n informational Olympiads you can participate in. For each Olympiad, you know the start and end dates and how much you will be rewarded. You can only attend one Olympiad during a day. Input The first input line is the integer n: number of informational Olympiads. Then, there are n lines. Each line has three integers s, e, r: starting day, ending day, reward Output Print only one integer x : the maximum amount of reward you can earn. (You can freely set the variable name.) Constraints Time limit : 1.00 Memory limit : 512MB 1 <n< 2*10^5 1 ssses 10^9 1 <r < 10^9 Example input: output: explain: 1 2 3 4 5 6 7 8 reward 4 4 2 4 4 6 2 3 6 6 6 8 2 5 7 3 7 3 First, Last Olympiads
use dynamic programming. the perfect algorithm;s this complexity
is O(n logn)
Task There are n informational Olympiads you can participate in. For each Olympiad, you know the start and end dates and how much you will be rewarded. You can only attend one Olympiad during a day. Input The first input line is the integer n: number of informational Olympiads. Then, there are n lines. Each line has three integers s, e, r: starting day, ending day, reward Output Print only one integer x : the maximum amount of reward you can earn. (You can freely set the variable name.) Constraints Time limit : 1.00 Memory limit : 512MB 1 <n< 2*10^5 1 ssses 10^9 1 <r < 10^9 Example input: output: explain: 1 2 3 4 5 6 7 8 reward 4 4 2 4 4 6 2 3 6 6 6 8 2 5 7 3 7 3 First, Last Olympiads