8.5-Day1T3--Asm.Def 的一秒
题目大意
略...
(吐槽这题面...让我毫无阅读兴趣)
题解
首先要求出在以两条斜线为新坐标轴下,每个点的坐标
那么....按x先排序
再求y的最长上升子序列
复杂度O(nlogn)吧
记得开longlong
- #include<cstdio>
- #include<algorithm>
- #include<cstring>
- #define ll long long
- using namespace std;
- inline ll read()
- {
- ll sum = ,p = ;
- char ch = getchar();
- while(ch < '' || ch > '')
- {
- if(ch == '-')
- p = -;
- ch = getchar();
- }
- while(ch >= '' && ch <= '')
- {
- (sum *= ) += ch - '';
- ch = getchar();
- }
- return sum * p;
- }
- const int maxn = ;
- ll n,a,b,c,d,f[maxn];
- struct pot
- {
- ll x,y;
- }p[maxn];
- bool cmp(pot a,pot b){return a.x < b.x;}
- ll lis()
- {
- ll len = ;
- for(int i = ;i <= n;i++)
- if(p[i].x > && p[i].y > )
- {
- if(p[i].y > f[len])
- f[++len] = p[i].y;
- else
- if(p[i].y< f[])
- f[] = p[i].y;
- else
- f[lower_bound(f + ,f + len + ,p[i].y) - f] = p[i].y;
- }
- return len;
- }
- int main()
- {
- n = read();
- a = read(),b = read(),c = read(),d = read();
- for(int i = ;i <= n;i++)
- {
- int x = read(),y = read();
- p[i].x = c * x - d * y;
- p[i].y = b * y - a * x;
- }
- sort(p+,p + n + ,cmp);
- printf("%lld",lis());
- return ;
- }
8.5-Day1T3--Asm.Def 的一秒的更多相关文章
- COGS2085 Asm.Def的一秒
时间限制:1 s 内存限制:256 MB [题目描述] “你们搞的这个导弹啊,excited!” Asm.Def通过数据链发送了算出的疑似目标位置,几分钟后,成群结队的巡航导弹从“无蛤”号头顶掠过 ...
- Asm.Def点大兵
syzoj上的题,收货很多,orz天天学长 原题: Asm.Def奉命组建一支m人的特种作战小队前往圣迭戈.他有n名候选人,可以在其中任意挑选.由于小队中每个人都有独特的作用,所以次序不同的两种选法被 ...
- cogs——2098. Asm.Def的病毒
2098. Asm.Def的病毒 ★☆ 输入文件:asm_virus.in 输出文件:asm_virus.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] “这就 ...
- COGS2090 Asm.Def找燃料
时间限制:1 s 内存限制:256 MB [题目描述] “听说咱们要完了?”比利·海灵顿拨弄着操纵杆,头也不回地问Asm.Def. “不要听得风就是雨.” “开个玩笑嘛.不就是打机器人,紧张啥,你 ...
- COGS 2091. Asm.Def的打击序列
★★★ 输入文件:asm_lis.in 输出文件:asm_lis.out 简单对比时间限制:4 s 内存限制:256 MB [题目描述] 白色圆柱形的“蓝翔”号在虚空中逐渐变大,一声沉 ...
- 2084. Asm.Def的基本算法
2084. Asm.Def的基本算法 传送门 ★☆ 输入文件:asm_algo.in 输出文件:asm_algo.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] ...
- COGS 2084. Asm.Def的基本算法
★☆ 输入文件:asm_algo.in 输出文件:asm_algo.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] “有句美国俗语说,如果走起来像鸭子,叫起来像 ...
- COGS 2082. Asm.Def谈笑风生
★ 输入文件:asm_talk.in 输出文件:asm_talk.out 简单对比时间限制:2 s 内存限制:256 MB [题目描述] “人呐都不知道,自己不可以预料,直升机刚一出圣 ...
- COGS 2098. Asm.Def的病毒
★☆ 输入文件:asm_virus.in 输出文件:asm_virus.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] “这就是我们最新研制的,世界上第一种可持 ...
- cogs——2084. Asm.Def的基本算法
2084. Asm.Def的基本算法 ★☆ 输入文件:asm_algo.in 输出文件:asm_algo.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] “有句 ...
随机推荐
- Java学习笔记(十二)面向对象---内部类
内部类的访问规则 内部类可以直接访问外部类中的成员,包括私有成员. 因为内部类中持有了一个外部类的引用,格式为:外部类名.this 外部类要访问内部类,必须要建立内部对象. class Outer { ...
- jdk8-》lambda
lambda表达式 使⽤场景(前提):⼀个接⼝中只包含⼀个⽅法,则可以使⽤Lambda表达式,这样的接⼝称之为“函数接⼝” 语法: (params) -> expression 第⼀部分为括 ...
- Consider using the `--user` option or check the permissions.
安装pip install C:\Users\道路\Documents\EGDownloads\pip-1.0.tar.gz 报错:Consider using the `--user` option ...
- 《NVM-Express-1_4-2019.06.10-Ratified》学习笔记(8.20)-- ANA
8.20 非对称namespace访问报告 8.20.1 非对称namespace访问报告概况 非对称Namespace访问(ANA)在如下场景下产生,基于访问这个namespace的controll ...
- centos下配置mongodb定期备份
https://brickyang.github.io/2017/03/02/Linux-%E8%87%AA%E5%8A%A8%E5%A4%87%E4%BB%BD-MongoDB/ 1.创建备份脚本 ...
- xrdp---远程桌面连接
xrdp is an Open Source Remote desktop Protocol server, which allows you to RDP to your Linux server ...
- C分支语句的工程用法
if语言中零值比较的注意点: -bool型变量应该直接出现于条件中,不要进行比较 -变量和零值比较时,零值应该出现在比较符号左边 -float型变量不能直接进行零值比较,需要定义精度 bool b = ...
- [CF]Round511
这场比赛我及时的参加了,但是打的时候状态实在是太烂了,只做出来了Div2的AB题. A Little C loves 3 I 直接构造就行. B Cover Points 应该很容易就看出来这个等腰三 ...
- Android基础知识 -- Fragment
Fragment是android3.0后提供的API(所以android:minSdkVersion="11"以上版本),主要针对平板UI.有自己的生命周期,但是必须依附在Acti ...
- python面试的100题(5)
5.现有字典 d= {'a':24,'g':52,'i':12,'k':33}请按value值进行排序? sorted(d.items(),key=lambda x:x[1]) sorted函数 对由 ...