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. BFC 详说 Block Formatting Contexts (块级格式化上下文)

    定位方案是控制元素的布局,在 CSS 2.1 中,有三种定位方案——普通流 (Normal Flow) .浮动 (Floats) 和绝对定位 (Absolute Positioning) ,下面分别对 ...

  2. Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) B. Code For 1

    地址:http://codeforces.com/contest/768/problem/B 题目: B. Code For 1 time limit per test 2 seconds memor ...

  3. 验证APNS证书的有效性

    openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert xxx.pem

  4. kivy sdl2 - ImportError: DLL load failed: 找不到指定的模块

    from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): ret ...

  5. 【VS Error】VS2008在编译时出现:Error 15 Cannot register assembly

    现象: 在visual studio 2008在编译类库时提示如下错误: Error 15 Cannot register assembly "D:\01_Work\02_SVN\OCRpl ...

  6. SQL学习笔记之MySQL查询的三层解析

    Mysqld的三层结构: SQL类型: DDL:数据库对象定义语言 对库和表的定义 DML:操作语言 DCL:控制语言 结构化的查询语言:select * from user; 执行该语句时: 1.连 ...

  7. Python3.x:BeautifulSoup()解析网页内容出现乱码

    Python3.x:BeautifulSoup()解析网页内容出现乱码 问题: start_html = requests.get(all_url, headers=Hostreferer) Beau ...

  8. 20145335郝昊《java程序设计》第7周学习总结

    20145335郝昊 <Java程序设计>第7周学习总结 教材学习内容总结 认识时间与日期 格林威治标准时间:简称GMT时间,参考格林威治皇家天文台的标准太阳时间. 世界时:简称UT,借由 ...

  9. Spring Boot企业微信点餐系统

    第1章 课程介绍 包括项演示.课程概述.课程安排.学习前提等的介绍, 让同学们了解这课程 1-1 课程介绍 第2章 项目设计 包括需求分析,项?目设计,项?目架构,数据库设计等等. 2-1 项目设计 ...

  10. Elasticsearch之分词器的作用

    前提 什么是倒排索引? Analyzer(分词器)的作用是把一段文本中的词按一定规则进行切分.对应的是Analyzer类,这是一个抽象类,切分词的具体规则是由子类实现的,所以对于不同的语言,要用不同的 ...