Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains 【树状数组维护区间最大值】
2021-07-14 13:06
标签:mes seconds ret tput hat exactly amp header lower 题目传送门:http://codeforces.com/contest/799/problem/C Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so each fountain cost can be either in coins or diamonds. No money changes between the types are allowed. Help Arkady to find two fountains with maximum total beauty so that he can buy both at the same time. The first line contains three integers n, c and d (2?≤?n?≤?100?000, 0?≤?c,?d?≤?100?000) — the number of fountains, the number of coins and diamonds Arkady has. The next n lines describe fountains. Each of these lines contain two integers bi and pi (1?≤?bi,?pi?≤?100?000) — the beauty and the cost of the i-th fountain, and then a letter "C" or "D", describing in which type of money is the cost of fountain i: in coins or in diamonds, respectively. Print the maximum total beauty of exactly two fountains Arkady can build. If he can‘t build two fountains, print 0. In the first example Arkady should build the second fountain with beauty 4, which costs 3 coins. The first fountain he can‘t build because he don‘t have enough coins. Also Arkady should build the third fountain with beauty 5 which costs 6 diamonds. Thus the total beauty of built fountains is 9. In the second example there are two fountains, but Arkady can‘t build both of them, because he needs 5 coins for the first fountain, and Arkady has only 4 coins. 有 N 个水池,每个水池有 观赏值 和 花费(金币或者钻石);Arkady有 C 个金币 D 个钻石,他想建两个水池,使得观赏值最高。 树状数组维护金币和钻石花费范围内所能得到的最大值,每次输入都比较三种可能性一个金币的一个钻石的,两个金币的,两个钻石的。 AC code: Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains 【树状数组维护区间最大值】 标签:mes seconds ret tput hat exactly amp header lower 原文地址:https://www.cnblogs.com/ymzjj/p/9538480.htmlC. Fountains
Input
Output
3 7 6
10 8 C
4 3 C
5 6 D9
2 4 5
2 5 C
2 1 D0
3 10 10
5 5 C
5 5 C
10 11 D10
Note
题目大意:
解题思路:
1 #include
文章标题:Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains 【树状数组维护区间最大值】
文章链接:http://soscw.com/index.php/essay/105117.html