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的更多相关文章

  1. ural 1203. Scientific Conference(动态规划)

    1203. Scientific Conference Time limit: 1.0 second Memory limit: 64 MB Functioning of a scientific c ...

  2. URAL 1203 Scientific Conference(贪心 || DP)

    Scientific Conference 之前一直在刷计算几何,邀请赛连计算几何的毛都买见着,暑假这一段时间就做多校.补多校的题目.刷一下一直薄弱的DP.多校假设有计算几何一定要干掉-.- 题意:给 ...

  3. URAL 1203 Scientific Conference dp?贪心

    题目:click here 分明就是贪心怎么会在dp的专题 #include <bits/stdc++.h> using namespace std; typedef unsigned l ...

  4. ural 1203. Scientific Conference

    http://acm.timus.ru/problem.aspx?space=1&num=1203 #include <cstdio> #include <cstring&g ...

  5. URAL 1203. Scientific Conference(瞎搞)

    题目链接 本来觉得这不是经典的贪心吗..果断水一次,wa了,看了看discuss,发现貌似不好水,土土的DP了一下,复杂度很高了,又T了...然后想想单调队列,二分什么的...不好往上加,直接搞了标记 ...

  6. ural 1009. K-based Numbers(简单dp)

    http://acm.timus.ru/problem.aspx?space=1&num=1009 题意:将一个n位数转化为合法的K进制数,有多少种情况.合法的K进制数即不含前导0,且任意两个 ...

  7. Uva LA 3902 - Network 树形DP 难度: 0

    题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...

  8. ZOJ 3822 Domination 概率dp 难度:0

    Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headm ...

  9. 快速切题 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 ...

随机推荐

  1. 【python】win10中python3.5.2输入pip出现Fatal error in launcher: Unable to create process using '"'

    系统:windows 10 python版本:3.5.2 出现的错误如下: C:\Users\zhuxy>pip list Fatal error in launcher: Unable to ...

  2. 20145316《Java程序设计》第七周学习总结

    20145316<Java学习程序设计>第七周学习总结 教材学习知识总结 1.在只有Lambda表达式的情况下,参数的类型必须写出来. 2.Lambda表达式本身是中性的,同样的Lambd ...

  3. jvm学习(重点)

    http://blog.csdn.net/yfqnihao/article/details/8271665 http://blog.csdn.net/cutesource/article/detail ...

  4. svn不提交.net项目中的bin

    1 选中 bin->右击->tortoiseSVN->add to ignore list->选择第二个 2 提交 , 服务器上就没有bin目录了.

  5. Java:出现错误提示(java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date)

    Java:出现错误提示(java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date) 原因分析: ...

  6. zabbix_server.log大量提示cannot send list of active checks to "IP": host [HostName] not found

    zabbix server 日志大量提示上图信息 原因是 zabbix_agent.conf配置文件中配置的HostName与zabbix的web界面配置的不同导致的 zabbix_agent.con ...

  7. 如何使一个openwrt下的软件开机自启动

    条件有三: 1.需要在软件包的Makefile中添加宏定义Package/$(package-name)/preinst和Package/$(package-name)/prerm define Pa ...

  8. uboot的FIT功能

    1.FIT介绍 Flattend Image Tree 英文原版介绍: FIT is formally a FDT, which can include images of various types ...

  9. MQ的前世今生

    1983年孟买26岁的工程师Vivek Ranadive设想一种软件总线,同年Teknekron诞生了.     最初用于高盛,用于解决金融交易.于是发布订阅的MQ The Information B ...

  10. ASP.NET OAuth Authorization - Difference between using ClientId and Secret and Username and Password

      What I don't fully understand is the use of ClientId and Secret vs Username and Password. The code ...