倒着推就是了

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int n, k, p, t, dp[10005];
vector<int> a[10005];//是他,就是他!我们的英雄vector!
int main(){
cin>>n>>k;
for(int i=1; i<=k; i++){
scanf("%d %d", &p, &t);
a[p].push_back(t);
}
for(int i=n; i>=1; i--){
if(a[i].size()){
for(int j=0; j<a[i].size(); j++)
dp[i] = max(dp[i], dp[i+a[i][j]]);
}
else dp[i] = dp[i+1] + 1;
}
cout<<dp[1]<<endl;
return 0;
}

最新文章

  1. 你真的会玩SQL吗?让人晕头转向的三值逻辑
  2. 360路由器刷openwrt、不死uboot、双系统 、wifi中继
  3. Android自定义相机拍照、图片裁剪的实现
  4. UISearchBar cover first cell of UITableView
  5. MSSQL 常用内置函数
  6. C#&nbsp;对Outlook联系人的增、删、查&nbsp;
  7. android Handler vs Timer
  8. Python之数据加密与解密及相关操作(hashlib模块、hmac模块、random模块、base64模块、pycrypto模块)
  9. tomcat警告setting property &#39;debug&#39; to &#39;0&#39; did not find a matching property
  10. Redis 使用命令行的方式 获取 hash type key 的value值
  11. Haproxy Nginx cluster构建
  12. MVP模式及性能优化
  13. 如何免费的让网站启用https
  14. [NOI 2016]循环之美
  15. mfc 类模板
  16. samba实现跨平台文件共享
  17. python2.0_day22_web聊天室二
  18. Windows消息队列(优先队列,结构体中放比较函数)
  19. Jmeter-常用函数之__CSVRead使用
  20. [Android-Demo]Android View的拖动

热门文章

  1. 在IDEA中编辑struts国际化properties文件
  2. BootStrap Validator 版本差异问题导致的submitHandler失效问题的解决方法
  3. linux命令行&mdash;《命令行快速入门》
  4. JDBC事务--软件开发三层架构--ThreadLocal
  5. PHP判断两个矩形是否相交
  6. Outlook 0x800CCC1A 错误
  7. BZOJ 3130: [Sdoi2013]费用流 网络流+二分
  8. Spring Mybatis PageHelper 设置使用
  9. Hybrid App开发之Html基本标签使用
  10. 使用HTML5语义标签时要注意的问题