Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C Fountains 乱搞

泛微OA与金蝶云星空深度集成实战:审批与表单双场景解析 本文深入解析泛微OA与金蝶云星空的深度集成实战,聚焦审批流程与表单对接两大核心场景。通过具体案例,详细阐述了如何实现业务数据与审批流程的自动联动,打破数据孤岛,提升企业运营效率与数据一致性,并分享了接口设计、安全策略及实战避坑指南。 阅读详情

C. Fountains
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

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.

Output

Print the maximum total beauty of exactly two fountains Arkady can build. If he can't build two fountains, print 0.

Examples
input
3 7 6
10 8 C
4 3 C
5 6 D
output
9
input
2 4 5
2 5 C
2 1 D
output
0
input
3 10 10
5 5 C
5 5 C
10 11 D
output
10
Note

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个喷泉,每个喷泉有个漂亮值和价格以及你能用哪种货币买,

问用已拥有的货币你买两个喷泉,最大漂亮值多少

必须要买两个,买不起两个就是0

价格的范围很小,可以开个数组dp【i】记录i货币可以买的最大价值

乱搞一下就可以了


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
struct node
{
	int p,b;
}cc[100050],dd[100050];
int dp[2][100050];
int cmp(node a,node b)
{
	return a.b<b.b;
}
int main()
{
	int n,c,d,p,b,i,j;
	int nc=0,nd=0;
	char ch;
	cin>>n>>c>>d;
	for(i=0;i<n;i++)
	{
		scanf("%d %d %c",&p,&b,&ch);//这个地方故意把p和b反过来了。。懒得改了
		node t;
		t.b=b;
		t.p=p;
		if(ch=='C')
		{
			cc[nc++]=t;//为什么不用vector。。。。。。傻了
		}
		else
		{
			dd[nd++]=t;
		}
	}
	sort(cc,cc+nc,cmp);
	sort(dd,dd+nd,cmp);
	node t;
	t.b=100005;
	t.p=0;
	cc[nc]=dd[nd]=t;
	int ans=0;
	for(i=0;i<nc;i++)
	{

		int last=c-cc[i].b;
		if(last>0)
		{
			if(last>=cc[i].b)
			{
				if(dp[0][cc[i].b]!=0)
				{
					ans=max(ans,dp[0][cc[i].b]+cc[i].p);
				}
			}
			else
			{
				if(dp[0][last]!=0)
				ans=max(ans,dp[0][last]+cc[i].p);
			}
		}
		for(j=cc[i].b;j<=cc[i+1].b;j++)
		{
			dp[0][j]=max(max(dp[0][j],dp[0][j-1]),cc[i].p);
		}
	}
//	for(i=0;i<20;i++)
//	cout<<i<<" "<<dp[0][i]<<endl;

	for(i=0;i<nd;i++)
	{

		int last=d-dd[i].b;
		if(last>0)
		{
			if(last>=dd[i].b)
			{
				if(dp[1][dd[i].b]!=0)
                ans=max(ans,dp[1][dd[i].b]+dd[i].p);
			}
			else
			{
				if(dp[1][last]!=0)
				ans=max(ans,dp[1][last]+dd[i].p);
			}
		}
		for(j=dd[i].b;j<=dd[i+1].b;j++)
		{
			dp[1][j]=max(max(dp[1][j],dp[1][j-1]),dd[i].p);
		}
	}
//	cout<<ans<<endl;
//	cout<<dp[0][c]<<" "<<dp[1][d]<<endl;
	if(ans==0&&(dp[0][c]==0||dp[1][d]==0))
	cout<<"0"<<endl;
	else
	{
	    if(dp[0][c]!=0&&dp[1][d]!=0)
		ans=max(ans,dp[0][c]+dp[1][d]);
		cout<<ans<<endl;
	}
	return 0;
 }



vLLM 多机多卡推理测试与验证(Kubernetes)vLLM 多机多卡推理 Kubernetes 验证 本文记录在两台 L20 机器,每台机器 4 块 L20 显卡(46G)的环境下,使用 vLLM 部署 Qwen2.5-32B-Instruct-GPTQ-Int4 模型并提供多节点多卡推理服务的过程。服务(Serving)模型服务是指将模型部署到生产环境中,通过 API 或其他接口提供预测服务的过程。【分布式推理与服务】(Distributed Inference and Serving)是指在多个机器或设备之间部署和管理机器学习模型,以高效地处理推理请求并满足大规模服务需求。3、启动 vLLM 服务。 阅读详情

相关推荐

Android息屏后台任务保活实战:从定时器失效到厂商白名单破解

本文深入探讨了Android应用在息屏后定时任务失效的根源,即系统为省电而触发的休眠机制。文章提供了从传统方案失效分析到实战破解的完整路径,核心在于引导用户将应用加入电池优化白名单并开启自启动权限,从而合法绕过限制。同时,结合WorkManager、AlarmManager等可靠定时方案,实现稳定的后台任务执行。

weixin_28475533的博客 433

Codeforces Round #541 (Div. 2) 题解

Codeforces Round #541 (Div. 2) 题目链接:https://codeforces.com/contest/1131 A. Sea Battle 题意: 给出两个矩形的宽和高,满足第一个矩形的左上顶点为(0,0),右下顶点为(w1,-h1);第二个矩形的坐下顶点为(0,0),右上顶点为(w2,h2)。然后求围绕这两个矩形一圈的格子个数为多少。 题...

dft539533的博客 283

基于AIS动态数据与AI结合得经纬度标示算法

港口船舶智能标注系统 本系统通过结合摄像头视频流和AIS船舶动态数据,利用AI技术实现船舶实时标注功能。系统架构包括视频流处理、AIS数据解析、船舶检测匹配和坐标映射转换等模块。关键技术步骤: AIS数据获取:通过本地接收机或网络API获取船舶位置、航速等信息 AI目标检测:采用YOLOv8等模型识别视频中的船舶 船舶匹配算法:通过位置投影或运动轨迹匹配视频目标与AIS数据 坐标映射:使用相机标定技术将经纬度转换为图像坐标 实时标注:在视频画面上叠加船名、位置等关键信息 应用场景包括港口监控、智能海事管理和

qianbo042311的博客 1819

Codeforces Round #413 C. Fountains(RMQ线段树)

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: coi

DorMOUSENone的博客 804

直线型一阶倒立摆1---从理论到实践的桥梁

本文深入探讨了直线型一阶倒立摆在控制理论中的核心地位,从非线性控制、鲁棒性到实时反馈等关键问题。通过实际案例和硬件搭建指南,帮助读者理解从理论到实践的过渡,特别适合控制工程初学者和研究人员。文章还提供了算法选型建议和硬件避坑手册,是掌握倒立摆控制的实用指南。

weixin_29047545的博客 328

一文入门Qwen-Agent【附实战代码】

Qwen-Agent 是一个开源框架,用于开发基于 Qwen 模型的 AI 智能体应用,一文带你入门使用

m0_55303420的博客 1886

Codeforces Round #413 C. Fountains

传送门 C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Arkady plays Gardenscapes a lot. Arka

twh233的算法blog 495

微信小程序 - 实现身份证OCR识别人像面与国徽面并提取字段信息,详解从手机相册选取或打开摄像头拍照上传身份证正反面图片ocr文字识别数据填充表单(提供免费纯前端ocr识别插件+百度OCR识别API)

微信小程序身份证识别,微信小程序身份证拍照、上传并OCR识别,微信小程序实现OCR扫描识别,微信小程序识别身份证免费插件,微信小程序实现身份证识别功能。ocr识别插件。微信身份证拍照后进行ocr识别,微信小程序OCR扫描识别身份证,OCR身份证实名认证+图片上传+拍照上传图片,微信小程序之身份证照片正反上传,小程序OCR身份证识别,微信小程序实现文字识别-ocr插件,微信小程序利用百度AI实现扫描身份证获取信息功能,基于微信小程序OCR插件实现身份证拍照、上传并OCR识别的示例demo,将上传的照片传到服务

🏆 前端领域优质创作者 8154

Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains(树状数组)

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:

SSimpLe_Y的博客 1290

基于Simulink环境,提供一个关于如何对EMI抑制的DC-DC变换器进行仿真建模的示例

EMI定义:电磁干扰是指任何能中断、阻碍、降低或限制电气设备有效性能的电磁能量。重要性合规性:确保产品符合国际和地方的EMC标准。可靠性:减少因外部或内部EMI导致的系统故障风险。挑战滤波设计:合理设计输入输出滤波器以抑制传导EMI。布局与接地:良好的PCB设计对于减少辐射EMI至关重要。屏蔽:使用金属屏蔽来保护敏感电路不受外界干扰。首先明确要模拟的任务内容。设计一个能够在高频操作下有效抑制EMI的DC-DC变换器。根据工作频率和谐振元件值确定合适的滤波器参数。

xiaoheshang_123的博客 152

基于深度学习YOLOv10的人脸表情识别系统(附完整资源+PySide6界面+训练代码)

本文介绍了如何基于YOLOv10实现一个人脸表情识别系统。我们从数据集准备、模型训练到PySide6界面实现进行了详细的讲解。通过该系统,用户可以实时检测和分类人脸表情,为情感分析、智能交互等应用场景提供支持。

YOLO 1059

Educational Codeforces Round 53 (Rated for Div. 2)C. Vasya and Robot(二分)

                                                                      C. Vasya and Robot Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0,0)(0,0). Robo...

shaohang_的博客 404

论文必备 - YOLO26统计数据集中大、中、小目标数量,附完整代码和详细使用步骤

数据集是由微软开发维护的大型图像数据集。数据集标注类型对应任务包括物体检测、关键点检测、实例分割、stuff分割(没有特定形状的物体),全景分割人体关键点, 人体密度检测等。官网数据规模和样本特点数据规模大:总共包含32.8万张图像)。其中标注过的图像超过 20 万张,拥有 150 万个目标实例,数据量丰富,能够为模型训练提供充足的信息。类别丰富:包含80个目标类别和91个“stuff”类别。目标类别涵盖了日常生活中常见的各种物体,如人、动物、交通工具、生活用品等;stuff。

Limiiiing的博客 283

Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)(A.暴力,B.优先队列,C.dp乱搞)...

A. Carrot Cakes time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In some game by Playrix it takes t min...

weixin_30872671的博客 149

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Codeforces Round #541 (Div. 2)总结

A. Sea Battle 水题,直接输出2*max(w1,w2)+2*(h1+h2)+4 ; 代码: #include&lt;bits/stdc++.h&gt; using namespace std; #define inf 0x3f3f3f #define ll long long const int maxn=1e4+9; int main(){ ios::sync_wit...

Zookkk的博客 236

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Codeforces Round #532 (Div. 2) E. Andrew and Taxi(二分+拓扑排序)

题目链接 题意 给你一个图1-n标号,m条有向边。 每条有向边有一个权值,代表翻转其方向所需代价。 求使得图变成无环图,翻转边权的最大值最小。 思路 二分答案,判断权值大于答案的边集是否能成环,如果不能说明答案可以再小点,否则答案可以大点。 关键是翻转哪些边比较难想,第一次感受到拓扑排序,排序二字用处。 按拓扑排序的顺序,给每个点从小到大赋权,最后判断如果起点权值大于终点权值则需要翻转。画个图就明...

←_← 1297

Codeforces Round #541 (Div. 2) D. Gourmet choice 并查集 拓扑排序

题解 题目大意,一个人第一天吃了n份食物第二天吃了m份食物,给你一个n*m的矩阵表示第一天的某份食物和第二天的某份食物哪个更好吃或一样好吃,要求你对每个食物进行打分满足所给矩阵。 首先使用并查集将一样好吃的情况缩为一个点进行处理,如果a&gt;b则b&lt;—a建一条单向边,如果a&lt;b则a—&gt;b建一条单向边。 初始入度为0的点评分设置为1,使用拓扑排序将当前点指向的点评分对当前点评分+...

CaprYang的博客 542

Codeforces Round #530 (Div. 2) F. Cookies(树形DP+线段树)

题目链接 题意 给你一棵树有n鸽节点,节点编号1-n,每个节点上有xi鸽饼干,每个节点上吃饼干吃一块需要pi时间 再给你每个节点的父亲,和经过这条边所花费时间 刚开始你在起点,两个人轮流进行以下步骤,你先手 你:移动到子节点,或者结束游戏并移动到根节点,选择性吃沿途饼干 对手:删一条你所在节点到儿子的边,或者什么都不做 你现在有T的时间求最多能吃多少饼干。 思路 从根节点开始深搜,对当前点求 当...

←_← 610

Codeforces Round #413 Div. 1 + Div. 2 B. T-shirt buying

Codeforces Round #413 Div. 1 + Div. 2 B. T-shirt buying B. T-shirt buying time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output A new pack of n

心随我动 668

CodeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)C题C. Fountains

C. Fountains

Fire Dancer 774

Codeforces Round #541 (Div. 2)

A题,数学画图题。 #include<iostream> #include<string> #include<algorithm> #include<cmath> #include<cstdlib> #include<climits> #include<stack> #include<vector> #...

weixin_44019404的博客 183

Fountains ___codeforces——799/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:...

小宫主的博客 393

Codeforces Round #541 (Div. 2)解题报告(A,B,C,D,E,F)

题目连接:http://codeforces.com/contest/1131 第一题(简单数学): #include&lt;bits/stdc++.h&gt; using namespace std; #define debug puts("YES"); #define rep(x,y,z) for(int (x)=(y);(x)&lt;(z);(x)++) #define ll lon...

满月照亮的路 315

【Codeforces Round #524 (Div. 2)】A.B.C.D

前言 一场对中国人特别友好地时间场,我上紫了! 开场前睡了一会感觉做A题的时候特别不清醒,一个变量名打错调了两分钟,5min1A,之后看B发现特别水,8min1A,然后开始看C,实在想不好两个长方形相交怎么处理,感觉要写特别多,之后去看D,D翻译完感觉更难,回来先写C不相交的情况,之后突然想到排序之后取中间的值就是相交,然后码码码,47min1A,之后去开D,直接想到做法,但是我的做法边界条件过于...

lajiyuan的博客 557

Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) B. T-shirt buying

直接stl水过。用set。做完第一个题用了一个半小时多,第二个题用了十几分钟,然后两个小时基本就没了,也没再看后边的题目。#include <iostream> #include <algorithm> #include <set> using namespace std;const int MAXN = 200010; int num[MAXN]; set<int> sets[4];int mai

梦幻的蔷薇色 420

Codeforces Round #541(Div.2) B. Draw!解题报告

题目链接 B.Draw! time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output You still have partial information about the score during the historic footba...

zrzzzlll的博客 462
上一篇: ecnu Problem #3233 N! //qduoj 阶乘问题
下一篇: G - odd-even number HDU - 5898 数位dp
jerans
博客等级 码龄10年 54粉丝 255原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值