HDU-5501 C-The Highest Mark

本文介绍了一道编程竞赛题目,目标是在有限时间内解决多个减分问题以获得最高分。通过动态规划算法确定解决问题的最佳顺序。

题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5501

The Highest Mark

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 1357    Accepted Submission(s): 576


 

Problem Description

The SDOI in 2045 is far from what it was been 30 years ago. Each competition has t minutes and n problems.

The ith problem with the original mark of Ai(Ai≤106),and it decreases Bi by each minute. It is guaranteed that it does not go to minus when the competition ends. For example someone solves the ith problem after x minutes of the competition beginning. He/She will get Ai−Bi∗x marks.

If someone solves a problem on x minute. He/She will begin to solve the next problem on x+1 minute.

dxy who attend this competition with excellent strength, can measure the time of solving each problem exactly.He will spend Ci(Ci≤t) minutes to solve the ith problem. It is because he is so godlike that he can solve every problem of this competition. But to the limitation of time, it's probable he cannot solve every problem in this competition. He wanted to arrange the order of solving problems to get the highest mark in this competition.

 

 

Input

There is an positive integer T(T≤10) in the first line for the number of testcases.(the number of testcases with n>200 is no more than 5)

For each testcase, there are two integers in the first line n(1≤n≤1000) and t(1≤t≤3000) for the number of problems and the time limitation of this competition.

There are n lines followed and three positive integers each line Ai,Bi,Ci. For the original mark,the mark decreasing per minute and the time dxy of solving this problem will spend.


Hint:
First to solve problem 2 and then solve problem 1 he will get 88 marks. Higher than any other order.

 

 

Output

For each testcase output a line for an integer, for the highest mark dxy will get in this competition.

 

 

Sample Input

 

1 4 10 110 5 9 30 2 1 80 4 8 50 3 2

 

 

Sample Output

 

88

 

题目分析:

       一开始做的时候以为这是个贪心问题,把得分直接通过a-b*c算出来,然后按照一定顺序排列取最优结果。忽略了第二题的时间应该要加上前一题的时间。所以要找出dp的规则,假设有题目a1,b1,b1和a2,b2,c2,如果先做1再做2的得分是a1-b1*c1+a2-b2*(c1+c2),如果先做2在做1的得分是a2-b2*c2+a1-b1*(c1+c2),所以只要b1*c2>=b2*c1第一题分数要比第二题分数高。

#include<iostream>
#include<algorithm>
#include<memory.h>
using namespace std;
struct que{
	int a;
	int b;
	int time; 
}quiz[1010];
bool cmp(que x,que y)
{
	return x.b*y.time>x.time*y.b;
}
int dp[3010],vis[3050];
//不可能并行回答题目 
int main(void)
{
	int T;
	cin>>T;
	while(T--)
	{
		memset(dp,0,sizeof(dp));
		memset(vis,0,sizeof(vis));
		int n,t;
		cin>>n>>t;
		for(int i=1;i<=n;i++)
		{
			cin>>quiz[i].a>>quiz[i].b>>quiz[i].time;
		}
		sort(quiz+1,quiz+n+1,cmp);
	    for(int i=1;i<=n;i++)
		{
			for(int j=t;j>=0;j--)
			{
				if(j>=quiz[i].time)
				{
					int score = quiz[i].a-quiz[i].b*(vis[j-quiz[i].time]+quiz[i].time);
					if(dp[j-quiz[i].time]+score>dp[j]){
						dp[j]=dp[j-quiz[i].time]+score;
						vis[j]=vis[j-quiz[i].time]+quiz[i].time;
					}
				}
			}			
		}
		cout<<dp[t]<<endl;			
	}
}


 

在人工智能研究的前沿,自然语言理解技术正受到广泛关注,其涵盖语音转写、跨语言转换、情绪判别及语义推断等多个分支。作为该领域的基石方法之一,基于大规模文本预先训练的语言表征模型,能够从海量语料中学习深层的语言规律,从而为各类后续应用任务提供强有力的语义表示支持。得益于硬件算力的提升与模型架构的持续优化,这类预训练模型已在多项自然语言理解评测中展现出卓越的性能。 本文重点探讨中文环境下的三项典型自然语言处理任务:TNEWS新闻主题归类、OCEMOTION情感倾向判断以及OCNLI语义推理验证。这三项任务分别对应文本分类、情感分析与逻辑推理三大核心方向,共同构成了从基础文本理解到复杂语义推演的技术链条。 TNEWS新闻主题归类任务旨在对涵盖政治、经济、科技、体育等多领域的新闻文本进行自动类别划分。该任务要求模型准确识别文本主旨并完成分类,属于典型的文本分类问题。 OCEMOTION情感分析任务则专注于从社交媒体、论坛评论等短文本中识别用户的情感极性。情感分析作为文本理解的重要维度,可为商业决策、舆情监测等提供关键依据,具有显著的应用价值。 OCNLI语义推理任务需要模型依据给定的前提语句与假设语句,判断后者是否可由前者逻辑推导得出。该任务检验模型对语句间语义关联与推理关系的理解能力,是衡量自然语言理解深度的重要标杆。 在上述任务中,数据分布的多标签与类别不均衡现象构成主要挑战。多标签指单一文本可能归属多个类别,而不均衡则表现为各类别样本数量差异悬殊。这种不平衡分布易导致模型过度拟合多数类别,从而削弱其泛化性能。为应对该问题,本方案综合采用了数据重采样、损失函数加权调整等技术,以提升模型在少数类别上的识别效果。 深度学习方法是实现上述任务的核心技术路径。通过设计多层神经网络结构,模型能够自动提取文本的深层特征,并建立从原始输入到任务目标的端到端映射。本方案所涉及的技术体系包括卷积神经网络、循环神经网络、长短期记忆网络以及基于自注意力机制的Transformer架构等。 参赛者需对提供的数据集进行预处理与分析,构建高效的深度学习模型,并通过训练、验证与测试环节系统评估模型性能。借助天池平台提供的强大算力资源与预训练模型基础,参赛者可进一步优化模型设计,提升任务表现。 本次研究不仅着眼于在特定评测任务上取得优异成绩,更致力于深入探索中文自然语言处理中的实际难题,为未来智能化应用与学术研究积累方法经验与技术储备。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值