19-10-15-Night-E
信心赛??高考赛……
过程
T1码了暴力+随机化。
T2没码完。$Kuku$了
T3写了暴力+ puts("86400\n-1"); 骗了点分。
T1
××你告诉我CF E题是T1??
首先分析问题:求$A,B$使得形如$\frac{A}{x}+\frac{B}{y}=z$的一堆柿子中有一个最小$z$值。
我们都不喜欢这种柿子。
于是进行转换,令$x'=\frac{1}{x},y'=\frac{1}{y}$。
我们都喜欢这样的柿子:
$$Ax'+By'=z$$
因为我们可以用类似斜率优化的思路去维护上/下凸包来解决这个问题。
不过说一点,请不要刚开始就$x=\frac{1}{x}$,一定被卡精度。
可以
- 化柿子,求斜率时用分式。
- 用$\frac{100000000\dots}{x}$
- 大骂出题人毒瘤
代码:
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 333333
#define LF long double using namespace std; template <typename T>
class Mystack{
T A[N*10];
int tp;
public:
Mystack(){tp=0;}
void clear(){tp=0;}
void pop(){tp--;}
T top(){return A[tp-1];}
T ttop(){return A[tp-2];}
void push(const T &k){A[tp++]=k;}
bool empty(){return tp==0;}
int size(){return tp;}
};
struct POINT{
int x,y;
int id,pos;
bool isk;
POINT(){}
POINT(const int a,const int b):x(a),y(b){}
}arr[N];
bool is_d[N],
flg[N],
isc[N];
int pn;
Mystack<POINT>st;
inline bool CMP1(const POINT &a,const POINT &b){
return a.x==b.x?a.y>b.y:a.x>b.x;
}
inline LF xl(POINT a,POINT b){
return (1.0*(a.y-b.y)*a.x*b.x)/(1.0*a.y*b.y*(a.x-b.x));
}
int main(){
// freopen("slay4.in","r",stdin);\
// freopen("1.out","w",stdout);
scanf("%d",&pn);
for(int i=1;i<=pn;i++){
scanf("%d%d",&arr[i].x,&arr[i].y);
arr[i].id=i;
}
sort(arr+1,arr+pn+1,CMP1);
for(int i=1;i<=pn;i++){
arr[i].pos=i;
// cout<<arr[i].x<<" "<<arr[i].y<<endl;
if((arr[i].x<arr[1].x && arr[i].y<arr[1].y) ||
(arr[i].x==arr[1].x && arr[i].y<arr[1].y) ||
(arr[i].x < arr[1].x && arr[i].y==arr[1].y))
arr[i].isk=1;
}
for(int i=1;i<=pn;){
int j=i+1;
while(j<=pn && arr[j].x==arr[i].x && arr[j].y==arr[i].y){is_d[j]=1;j++;}
i=j;
}
st.push(arr[1]);
int t=2;
while(is_d[t] || arr[t].isk)t++;
st.push(arr[t]);
// cout<<t<<endl;
for(int i=t+1;i<=pn;i++){
if(is_d[i] || arr[i].isk || xl(st.top(),arr[i])>=0)
continue;
while(st.size()>1 && xl(st.ttop(),st.top()) > xl(st.top(),arr[i]))
st.pop();
st.push(arr[i]);
}
while(!st.empty()){
isc[st.top().id]=1;
flg[st.top().pos]=1;
st.pop();
//cerr<<123<<endl;
}
for(int i=1;i<=pn;){
if(flg[i]){
int j=i+1;
while(is_d[j]){
isc[arr[j++].id]=1;
}
i=j;
}
else i++;
}
for(int i=1;i<=pn;i++)
if(isc[i])
printf("%d ",i);
puts("");
}
T2T3
gugugu
19-10-15-Night-E的更多相关文章
- 程序员的 Ubuntu 19.10 配置与优化指南
原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...
- 背水一战 Windows 10 (15) - 动画: 缓动动画
[源码下载] 背水一战 Windows 10 (15) - 动画: 缓动动画 作者:webabcd 介绍背水一战 Windows 10 之 动画 缓动动画 - easing 示例演示缓动(easing ...
- Linux Kernel 3.11.4/3.10.15/3.4.65/3.0.99
Linux 今天又发布了4个更新版本,分别是: 3.11.4 2013-10-05 [tar.xz] [pgp] [patch] [view patch] [view inc] [cgit] [cha ...
- CVE-2015-1328 Ubuntu 12.04, 14.04, 14.10, 15.04 overlayfs Local Root
catalog . 引言 . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch ...
- WTL汉化版2013.10.15
汉化内容: 2013.10.15 版本:当前可下载Trunk最新版,wtl-code-467-trunk.zip 汉化内容: 1.应用向导的部分汉化,考虑到部分词汇的表述问题,只汉化无影响部分 2.资 ...
- [Mon Feb 10 15:21:06 2014] [notice] child pid 7101 exit signal File size limit exceeded (25)
今天遇到的问题: LAMP的LOG里报如下错误. 然后IE和FIREFOX里显示连接被重置或是无法访问. 但自己建一个正常的PHP测试探针倒可以. 原来是PHP错误日志太多,无法写入LOG导致. [r ...
- Datatables插件1.10.15版本服务器处理模式ajax获取分页数据实例解析
一.问题描述 前端需要使用表格来展示数据,找了一些插件,最后确定使用dataTables组件来做. 后端的分页接口已经写好了,不能修改.接口需要传入页码(pageNumber)和页面显示数据条数(pa ...
- Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24
作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...
- macOS 10.15 开启 HiDPI
普通的显示,接上 MacBook 发现原生的分辨率设置在 2K 显示器上字体很小,换成 1080P 分辨率显示效果又特别模糊.下面介绍MacBook强行开启 HiDPI. 什么是 HiDPI 它使用横 ...
- npm install 提示 `gyp: No Xcode or CLT version detected!` MacOS 10.15
https://github.com/nodejs/node-gyp/issues/569 https://github.com/nodejs/node-gyp/issues/1927 解决链接:ht ...
随机推荐
- PHP缓存技术简单介绍
一.数据缓存 这里所说的数据缓存是指数据库查询缓存,每次访问页面的时候,都会先检测相应的缓存数据是否存在,如果不存在,就连接数据库,得到数据,并把查询结果序列化后保存到文件中,以后同样的查询结果就直接 ...
- 线性dp——cf1067A
考虑三种情况,刷表dp+前缀和预处理即可 #include<bits/stdc++.h> using namespace std; ; ],f[][][],ans,s; int main( ...
- 修改docker+jenkins挂载目录
1.停止docker [root@jenkins data]# systemctl stop docker 2.创建目录,拷贝数据 [root@jenkins data]# mkdir -p /new ...
- IE6/IE7尿性笔记 && avalon && director
表单提交 [ie6] form默认特性(input回车以及点击type=submit的按钮会自动触发form submit),在ie6中,不能使button[submit],必须是input[subm ...
- JAVA基础_泛型
什么是泛型 泛型是提供给javac编译器使用的,可以限定集合中的输入类型,让编译器挡住源程序中的非法输入,编译器编译带类型说明的集合时会去除掉"类型"信息,是程序的运行效率不受影响 ...
- git -- 项目开发最常用操作记录
官方Git - Book https://git-scm.com/book/zh/v2 ------------------------------git配置以及公钥生成--------------- ...
- 09_springmvc图片上传
一.上传图片 1.需求 在修改商品页面,添加上传商品图片的功能 2.springmvc中对多部件类型解析 在页面form中提交enctype="multipart/form-data&quo ...
- 初识OpenCV-Python - 007: 平滑图像
本节内容主要将如何平滑图像.如通过低通道滤波模糊图像.或者自定义滤波处理图像. import cv2import numpy as npfrom matplotlib import pyplot as ...
- 2、Zookeeper原理及应用汇总
1 Zookeeper简介-分布式服务框架 ZooKeeper为分布式应用程序提供高效且可靠的分布式协调服务,提供的服务:配置管理.统一命名服务.分布式同步.组服务等,是Google Chubby的开 ...
- JS中鲜为人知的问题: [] == ![]结果为true,而 {} == !{}却为false
console.log( [] == ![] ) // true console.log( {} == !{} ) // false 在比较字符串.数值和布尔值的相等性时,问题还比较简单.但在涉及到对 ...