杭电4001 亚洲区预赛大连赛区

这道题做了有两天了吧,今天才总算找到错误,本来我想了一种思路,一直wr,找错误一直找不到,今天下午吃过饭后和lky讨论了一下,才总算明白我的思路错在了哪里,看来,互相交流还是很有必要的啊。。。。。。。。。题目:

Do you remember our children time? When we are children, we are interesting in almost everything around ourselves. A little thing or a simple game will brings us lots of happy time! LLL is a nostalgic boy, now he grows up. In the dead of night, he often misses something, including a simple game which brings him much happy when he was child. Here are the game rules: There lies many blocks on the ground, little LLL wants build "Skyscraper" using these blocks. There are three kinds of blocks signed by an integer d. We describe each block's shape is Cuboid using four integers ai, bi, ci, di. ai, bi are two edges of the block one of them is length the other is width. ci is
thickness of the block. We know that the ci must be vertical with earth ground. di describe the kind of the block. When di = 0 the block's length and width must be more or equal to the block's length and width which lies under the block. When di = 1 the block's length and width must be more or equal to the block's length which lies under the block and width and the block's area must be more than the block's area which lies under the block. When di = 2 the block length and width must be more than the block's length and width which lies under the block. Here are some blocks. Can you know what's the highest "Skyscraper" can be build using these blocks?

Input
The input has many test cases.
For each test case the first line is a integer n ( 0< n <= 1000) , the number of blocks.
From the second to the n+1'th lines , each line describing the i‐1'th block's a,b,c,d (1 =< ai,bi,ci <= 10^8 , d = 0 or 1 or 2).
The input end with n = 0.

Output
Output a line contains a integer describing the highest "Skyscraper"'s height using the n blocks.

Sample Input
3 10 10 12 0 10 10 12 1 10 10 11 2 2 10 10 11 1 10 10 11 1 0

Sample Output
24 11

ac代码:

#include <iostream> #include <algorithm> #include <cstdio> using namespace std; struct block { _int64 len; _int64 wid; _int64 hi; _int64 num; }aa[1005]; bool cmp(block a,block b) { if(a.len==b.len) { if(a.wid==b.wid) return a.num>b.num; return a.wid<b.wid; } return a.len<b.len; } int main() { int n; while(scanf("%d",&n)) { if(n==0) return 0; int i,j; _int64 a,b,dp[1005]; for(i=0;i<n;++i) { scanf("%I64d%I64d%I64d%I64d",&a,&b,&aa[i].hi,&aa[i].num); if(a>b) {aa[i].len=a;aa[i].wid=b;} else {aa[i].len=b;aa[i].wid=a;} } sort(aa,aa+n,cmp); for(i=0;i<n;++i) dp[i]=aa[i].hi; _int64 mmax=dp[0]; for(i=1;i<n;++i) { for(j=0;j<i;++j) { if(aa[i].num==0) { if(aa[i].len>=aa[j].len&&aa[i].wid>=aa[j].wid&&dp[i]<aa[i].hi+dp[j]) dp[i]=dp[j]+aa[i].hi; } else if(aa[i].num==1) { if(aa[i].len>=aa[j].len&&aa[i].wid>=aa[j].wid&&(aa[i].len>aa[j].len||aa[i].wid>aa[j].wid)&&dp[i]<aa[i].hi+dp[j]) dp[i]=dp[j]+aa[i].hi; } else { if(aa[i].len>aa[j].len&&aa[i].wid>aa[j].wid&&dp[i]<aa[i].hi+dp[j]) dp[i]=dp[j]+aa[i].hi; } } if(dp[i]>mmax) mmax=dp[i]; } printf("%I64d\n",mmax); } return 0; }

内容概要:本文介绍了基于贝叶斯优化的CNN-LSTM混合神经网络在时间序列预测中的应用,并提供了完整的Matlab代码实现。该模型结合了卷积神经网络(CNN)在特征提取方面的优势与长短期记忆网络(LSTM)在处理时序依赖问题上的强大能力,形成一种高效的混合预测架构。通过贝叶斯优化算法自动调参,提升了模型的预测精度与泛化能力,适用于风电、光伏、负荷、交通流等多种复杂非线性系统的预测任务。文中还展示了模型训练流程、参数优化机制及实际预测效果分析,突出其在科研与工程应用中的实用性。; 适合人群:具备一定机器学习基基于贝叶斯优化CNN-LSTM混合神经网络预测(Matlab代码实现)础和Matlab编程经验的高校研究生、科研人员及从事预测建模的工程技术人员,尤其适合关注深度学习与智能优化算法结合应用的研究者。; 使用场景及目标:①解决各类时间序列预测问题,如能源出力预测、电力负荷预测、环境数据预测等;②学习如何将CNN-LSTM模型与贝叶斯优化相结合,提升模型性能;③掌握Matlab环境下深度学习模型搭建与超参数自动优化的技术路线。; 阅读建议:建议读者结合提供的Matlab代码进行实践操作,重点关注贝叶斯优化模块与混合神经网络结构的设计逻辑,通过调整数据集和参数加深对模型工作机制的理解,同时可将其框架迁移至其他预测场景中验证效果。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值