URAL 1203 Scientific Conference 简单dp 难度:0
http://acm.timus.ru/problem.aspx?space=1&num=1203
按照结束时间为主,开始时间为辅排序,那么对于任意结束时间t,在此之前结束的任务都已经被处理,从这个时间开始的任务都正要被处理,
因为t<=3e5,可以用简单dp解决
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=1e5+5;
int n;
typedef pair<int,int> P;
P t[maxn];
int dp[maxn];
int ans;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d%d",&t[i].first,&t[i].second);
}
sort(t,t+n);
for(int i=1,j=0;i<=30001;i++){
ans=max(ans,dp[i-1]); if(j==n||i<t[j].first)continue;
while(t[j].first==i){
dp[t[j].second]=max(dp[t[j].second],ans+1);
j++;
}
}
printf("%d\n",ans);
return 0;
}
URAL 1203 Scientific Conference 简单dp 难度:0的更多相关文章
- ural 1203. Scientific Conference(动态规划)
1203. Scientific Conference Time limit: 1.0 second Memory limit: 64 MB Functioning of a scientific c ...
- URAL 1203 Scientific Conference(贪心 || DP)
Scientific Conference 之前一直在刷计算几何,邀请赛连计算几何的毛都买见着,暑假这一段时间就做多校.补多校的题目.刷一下一直薄弱的DP.多校假设有计算几何一定要干掉-.- 题意:给 ...
- URAL 1203 Scientific Conference dp?贪心
题目:click here 分明就是贪心怎么会在dp的专题 #include <bits/stdc++.h> using namespace std; typedef unsigned l ...
- ural 1203. Scientific Conference
http://acm.timus.ru/problem.aspx?space=1&num=1203 #include <cstdio> #include <cstring&g ...
- URAL 1203. Scientific Conference(瞎搞)
题目链接 本来觉得这不是经典的贪心吗..果断水一次,wa了,看了看discuss,发现貌似不好水,土土的DP了一下,复杂度很高了,又T了...然后想想单调队列,二分什么的...不好往上加,直接搞了标记 ...
- ural 1009. K-based Numbers(简单dp)
http://acm.timus.ru/problem.aspx?space=1&num=1009 题意:将一个n位数转化为合法的K进制数,有多少种情况.合法的K进制数即不含前导0,且任意两个 ...
- Uva LA 3902 - Network 树形DP 难度: 0
题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...
- ZOJ 3822 Domination 概率dp 难度:0
Domination Time Limit: 8 Seconds Memory Limit: 131072 KB Special Judge Edward is the headm ...
- 快速切题 sgu104. Little shop of flowers DP 难度:0
104. Little shop of flowers time limit per test: 0.25 sec. memory limit per test: 4096 KB PROBLEM Yo ...
随机推荐
- git---小乌龟提交
下载地址:https://tortoisegit.org/ 比如我修改了文件: 1.本地提交在项目目录内右键,点击git commit按钮 2.拉去线上最新代码,与本地代码合并 3.向线上推送
- 101. Symmetric Tree(判断二叉树是否对称)
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For ...
- 2017 Multi-University Training Contest - Team 4 hdu6069 Counting Divisors
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6069 题目: Counting Divisors Time Limit: 10000/5000 ...
- web前端基础——初识JavaScript
1 JavaScript概述 JavaScript是一种属于网络的脚本语言,已经被广泛用于Web应用开发,常用来为网页添加各式各样的动态功能,为用户提供更流畅美观的浏览效果.通常JavaScript脚 ...
- TOSCA自动化测试工具--openURL
在folder下面create test case 输入自己的url,actionMode 是input, String类型
- 设置eclipse编码格式
1.修改eclipse默认工作空间编码方式.点击Window-->Preferences-->General-->Workspace,设置编码格式为UTF-8,然后点击OK.
- Hive的静态分区和动态分区
作者:Syn良子 出处:http://www.cnblogs.com/cssdongl/p/6831884.html 转载请注明出处 虽然之前已经用过很多次hive的分区表,但是还是找时间快速回顾总结 ...
- 解决NodeJS+Express模块的跨域访问控制问题:Access-Control-Allow-Origin
在一个项目上想用NodeJS,在前端的js(http://localhost/xxx)中ajax访问后端RestAPI(http://localhost:3000/….)时(Chrome)报错: XM ...
- Hexo博客配置笔记
安装Hexo npm install hexo-cli -g cd /blog hexo init 安装next主题 git clone https://github.com/iissnan/hexo ...
- Android Camera API ISO Setting
https://stackoverflow.com/questions/2978095/android-camera-api-iso-setting exif this.mCameraParamete ...