囧啊,读错题了,一直在想为什么是DP。误以为当时间相同是可以一起删除。后来发现并非如此。用ans[i]记录前i条信息全部删除的最短时间,dele[i][i]表示删除第i条信息所需的时间,opt[a][b]是从a到b一起删除的时候所需的时间。用结构体表示 到达时间 ( arr ),删除所需时间(cost )。

转移方程为 cnt = max ( ans[j], mess[i].arr ) + opt[j + 1][i] , ans[i] = min ( ans[i], cnt )  ( 0 <= j < i )

#include <cstdio>
#include <cstring>
#include <algorithm>
const int MAXX = 1 << 29;
using namespace std;struct Mess {int arr, cost;
}mess[505];int Case, ans[505], opt[505][505], m[505][505], l[505][505];void init ( ) {for ( int i = 1; i <= Case; ++i ) {l[i][i] = m[i][i] = opt[i][i] = mess[i].cost;ans[i] = MAXX;}for ( int i = 1; i < Case; ++i ) {for ( int j = i + 1; j <= Case; ++j ) {l[i][j] = min ( l[i][j - 1], mess[j].cost );m[i][j] = max ( m[i][j - 1], mess[j].cost );opt[i][j] = m[i][j] + l[i][j];}}
}void dp ( ) {init ( );for ( int i = 1; i <= Case; ++i )for ( int j = 0; j < i; ++j )if ( ans[i] >= max ( ans[j], mess[i].arr ) + opt[j + 1][i] ) ans[i] = max ( ans[j], mess[i].arr ) + opt[j + 1][i];
}bool cmp ( Mess a, Mess b ) {return a.arr < b.arr;
}int main ( ) {while ( scanf ( "%d", &Case ) != EOF ) {for ( int i = 1; i <= Case; ++i )scanf ( "%d%d", &mess[i].arr, &mess[i].cost );sort ( mess + 1, mess + Case + 1, cmp );dp ( );printf ( "%d\n", ans[Case] );}
}

HEU The message相关推荐

  1. 规范的 Commit Message

    在 Angular 规范中,Commit Message 包含三个部分,分别是 Header.Body 和 Footer,格式如下: <type>[optional scope]: < ...

  2. Setting the Reply-To Header in an Email using CDONTS.NewMail Object and CDO Message

    代码  1 <%  2 Option Explicit  3   4 Dim objMail  5 Dim strSubject  6 Dim strBody  7   8 strSubject ...

  3. EMQ学习笔记---Clean Session和Retained Message

    MQTT会话(Clean Session) MQTT客户端向服务器发起CONNECT请求时,可以通过'Clean Session'标志设置会话. 'Clean Session'设置为0,表示创建一个持 ...

  4. Message、Handler、Message Queue、Looper之间的关系

    2019独角兽企业重金招聘Python工程师标准>>> 在单线程模型下,为了解决线程通信问题,Android设计了一个通信机制.Message Queue(消息队列), 线程间的通信 ...

  5. CAS (10) —— JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法...

    CAS (10) -- JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法 jboss版本: jb ...

  6. 使用alterMIME实现添加message footer功能

    1. 安装alterMIME   tar zxvf altermime-0.3.8.tar.gz   cd altermin3-0.3.8   make   make install   alterm ...

  7. Selenium 爬虫时遇到的问题 Selenium message:session not created

    出现问题如下: Selenium message:session not created: This version of ChromeDriver only supports Chrome vers ...

  8. Warning message:NAs introduced by coercion

    Warning message:NAs introduced by coercion 目录 Warning message:NAs introduced by coercion 问题: 解决: 完整问 ...

  9. Warning message:In a + b : longer object length is not a multiple of shorter object length

    Warning message:In a + b : longer object length is not a multiple of shorter object length 目录 Warnin ...

最新文章

  1. 虚幻引擎5:从零开始的蓝图近战AI学习教程
  2. 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接
  3. hdu4614 Vases and Flowers 线段树+二分
  4. 简单一码付:将支付宝和微信的收款二维码合并为一个二维码
  5. 堪比熊猫烧香!中国新型蠕虫病毒大爆发!电脑瞬间报废
  6. 猴年猴赛雷,曙光服务器全面升级E5-v4平台
  7. Apriori算法——中医病症辩证关联规则分析
  8. 三极管工作原理分析,精辟、透彻
  9. Oracle - 索引
  10. 游戏精细化营销不靠买量 获客也能踩着夏天的西瓜皮直线上升!
  11. cordova build android 出错问题汇总
  12. pytorch镜像安装【清华源】
  13. pyqt5 QPainter绘制图形,并旋转
  14. JAAS配置介绍(转载)
  15. “自动”与“自动(延迟启动)”
  16. hive 字符串拼接函数
  17. 人工智能正在向经济学领域渗透
  18. Ubuntu 1404
  19. markdown常用表情
  20. 井下测量类毕业论文文献都有哪些?

热门文章

  1. Mac下安装DBeaver
  2. 【Gitee + Hexo】从0开始搭建自己的博客网站
  3. 四路组相联原理_计算机组成原理中是如何求是几路组相联映像?
  4. 值得看三次的高干文_值得看三次的高干文,熬夜都要看
  5. 使用 GOLANG 发送邮件
  6. 阿里云服务器持久内存型re6p实例采用Intel傲腾持久内存
  7. 智能家居的春天来临 曾经共患难的集成商如今能同享福吗?
  8. 有你智居告诉你,智能门禁是如何做到出入小区只需1秒钟的?
  9. 实验一:Cifar10图像分类竞赛 学习记录
  10. pandas学习手记-柱状图