Gym-100820 Racing Gems(二维LIS)
来源:互联网 发布:09和冷冷的故事 知乎 编辑:程序博客网 时间:2024/06/09 17:23
传送门:http://codeforces.com/gym/100820/attachments
#include<bits/stdc++.h>using namespace std;typedef long long LL;const int MX = 1e5 + 5;struct node{ LL a,b;}p[MX];bool cmp(node p1,node p2){ if(p1.a!=p2.a) return p1.a<p2.a; return p1.b<p2.b;}LL d[MX];int main(){ int n,r,w,h; //freopen("in.txt","r",stdin); while(~scanf("%d%d%d%d",&n,&r,&w,&h)){ for(int i=1;i<=n;i++){ LL x,y; scanf("%I64d%I64d",&x,&y); p[i].a=r*(w-x)+y; p[i].b=r*x+y; } sort(p+1,p+n+1,cmp); memset(d,0x3f,sizeof(d)); int len=0; for(int i=1;i<=n;i++){ int pos=upper_bound(d+1,d+n+1,p[i].b)-d; d[pos]=p[i].b; len=max(len,pos); } printf("%d\n",len); } return 0;}
阅读全文
0 0
- Gym-100820 Racing Gems(二维LIS)
- gym 100820G Racing Gems(二维LIS,好题)
- GYM 100820 G.Racing Gems(LIS)
- 二维LIS Gym100820G Racing Gems
- Gym100820G/UVALive7374 Racing Gems 二维LIS 思维题
- Racing Gems
- 【2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div 1)G】【坐标轴变换 LIS】Racing Gems 开车吃宝石,横向速度不能超
- UVALive 7374 Racing Gems (最长上升子序列--二分法)
- UVALive 7374 Racing Gems - dp,最长上升子序列
- jdfz-2764 二维LIS
- UVALive-7374-Racing Gems(最长上升子序列O(n*logn))
- SGU 199. Beautiful People 二维LIS
- acd - 1216 - Beautiful People(二维LIS)
- 二维无序LIS ACdream1216 Beautiful People
- POJ1609 二维数组快排+LIS
- hdu1069 Monkey and Banana(二维LIS)
- ZOJ 2319 (二维的LIS)
- HDU 6199 gems gems gems
- 如何终止java线程
- java.util.Properties类
- 修饰词的用法
- 简单了解Effective java
- 单链表一些总结
- Gym-100820 Racing Gems(二维LIS)
- Alice, Bob, Two Teams CodeForces
- mysql row模式的一些小问题(一)
- 浅拷贝、深拷贝与写时拷贝
- Integer源码(toHexString).md
- 构造代码块笔记
- ActiveMQ实战(三)--ActiveMQ的通信方式之主题发布订阅式(publish-subscribe)
- Codeforces 822C Hacker pack your bags! 区间
- 多态笔记