ural 1203. Scientific Conference(动态规划)
1203. Scientific Conference
Input
Output
Sample
input | output |
---|---|
5 |
3 |
#include <cstring>
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
struct node
{
int x,y;
} p[];
int flag[];
int cmp(node a,node b)
{
if(a.x == b.x)
return a.y < b.y;
else
return a.x < b.x;
}
int main()
{
freopen("1.txt","r",stdin);
int n,i,j,ans,maxz,top;
scanf("%d",&n);
for(i =; i < n; i ++)
{
scanf("%d%d",&p[i].x,&p[i].y);
}
memset(flag,-,sizeof(flag));
sort(p,p+n,cmp);
ans=;
flag[] = p[].y;
top = ;
for(i =;i<n;i++)
{
maxz = ;
for(j=top;j>=;j--)
{
if(p[i].x>flag[j])
{
maxz=j;
break;
}
}
if(flag[maxz+]==-)
{
flag[maxz+] = p[i].y;
top ++;
}
else
flag[maxz+] = min(flag[maxz+],p[i].y);
}
printf("%d\n",top);
}
ural 1203. Scientific Conference(动态规划)的更多相关文章
- URAL 1203 Scientific Conference(贪心 || DP)
Scientific Conference 之前一直在刷计算几何,邀请赛连计算几何的毛都买见着,暑假这一段时间就做多校.补多校的题目.刷一下一直薄弱的DP.多校假设有计算几何一定要干掉-.- 题意:给 ...
- ural 1203. Scientific Conference
http://acm.timus.ru/problem.aspx?space=1&num=1203 #include <cstdio> #include <cstring&g ...
- URAL 1203 Scientific Conference 简单dp 难度:0
http://acm.timus.ru/problem.aspx?space=1&num=1203 按照结束时间为主,开始时间为辅排序,那么对于任意结束时间t,在此之前结束的任务都已经被处理, ...
- URAL 1203. Scientific Conference(瞎搞)
题目链接 本来觉得这不是经典的贪心吗..果断水一次,wa了,看了看discuss,发现貌似不好水,土土的DP了一下,复杂度很高了,又T了...然后想想单调队列,二分什么的...不好往上加,直接搞了标记 ...
- URAL 1203 Scientific Conference dp?贪心
题目:click here 分明就是贪心怎么会在dp的专题 #include <bits/stdc++.h> using namespace std; typedef unsigned l ...
- bzoj1814: Ural 1519 Formula 1 动态规划 插头dp
http://acm.timus.ru/problem.aspx?space=1&num=1519 题目描述 一个 m * n 的棋盘,有的格子存在障碍,求经过所有非障碍格子的哈密顿回路个数. ...
- URAL DP第一发
列表: URAL 1225 Flags URAL 1009 K-based Numbers URAL 1119 Metro URAL 1146 Maximum Sum URAL 1203 Scient ...
- URAL(DP集)
这几天扫了一下URAL上面简单的DP 第一题 简单递推 1225. Flags #include <iostream> #include<cstdio> #include< ...
- ACM会议列表与介绍(2014/05/06)
Conferences ACM SEACM Southeast Regional Conference ACM Southeast Regional Conference the oldest, co ...
随机推荐
- Unity3D脚本使用:物体调用物体
如下图4种方式: 方式5 通过Tag定位物体 1.先对物体定义标签Tag,可选已有或自定义 2.通过Tag名称找到对象 注意:如果标签对应多个对象,需使用获取对象集合再进行处理
- 运行ORB-SLAM笔记_编译篇(一)
1.下载代码 https://github.com/raulmur/ORB_SLAM/ (同时也可以看看作者的牛叉论文,我是打算先用代码,再回头看论文) 2.打开后如下 就好像是用一件新产品 ...
- ubuntu14通过trove/redstack安装openstack环境
---恢复内容开始--- Trove Installation Trove is constantly under development. The easiest way to install Tr ...
- Silverlight 中MatrixTransform和其他Transform的数值转换
对各种transform的讲解已经很多了,但是有时MatrixTransform和其他transform变换效果之间需要转换时,变换量的转换又如何呢?下面的类就完成了Matrix和其他transfor ...
- jquery一个简单的菜单小插件
刚学会封装插件,先来封装一个小的菜单插件 html部分 <ul class="zong"> <li class="yiji"> < ...
- 一个IT人士的个人经历,给迷失方向的朋友(转)
作者: 果子狸 来源: WP开发者社区 发布时间: 2013-11-08 10:43 阅读: 50078 次 推荐: 494 原文链接 [收藏] 这些日子我一直在写一个实时操作系统内核 ...
- LeetCode 280. Wiggle Sort C#
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] < ...
- Intelli IDEA 使用教程
1.怎样修改字体 File-Settings-color&Fonts-Fonts
- 常用Git命令大全
Git命令 查看.添加.提交.删除.找回,重置修改文件 git help <command> # 显示command的help git show # 显示某次提交的内容 git show ...
- iOS Plugins
iOS Plugins This section provides details for how to implement native plugin code on the iOS platfor ...