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 ...
随机推荐
- 如何用excel统计调查问卷
如何用excel统计调查问卷 有些人可能经常要对调查问卷进行统计,使用手写的方法(就是在纸上写正字的方法)虽然很方便,不过不方便在一定条件下进行统计,如在男士的条件下,使用诺基亚的手机有多少人.而用e ...
- service sshd start启动失败,Badly formatted port number.
在做xhell学习的时候,把端口号修改了,后面忘记修改回 来,导致 [root@MyRoth 桌面]# service sshd start 正在启动 sshd:/etc/ssh/sshd_confi ...
- PAT甲级——A1125 Chain the Ropes【25】
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fo ...
- 「APIO 2019」路灯
题目 显然一个熟练的选手应该能一眼看出我们需要维护点对的答案 显然在断开或连上某一条边的时候只会对左右两边联通的点产生贡献,这个拿\(set\)维护一下就好了 那现在的问题就是怎么维护了 考虑一个非常 ...
- 【LGP4714】「数学」约数个数和
题目 众所周知,除数个数函数\(\sigma_0=I^2\),\(I\)就是狄利克雷卷积里的\(1\)函数 于是熟悉狄利克雷卷积的话很快就能看出我们要求的就是\(I\times I^{k}\),即\( ...
- 2019牛客国庆集训派对day5
2019牛客国庆集训派对day5 I.Strange Prime 题意 \(P=1e10+19\),求\(\sum x[i] mod P = 0\)的方案数,其中\(0 \leq x[i] < ...
- POJ 2074 /// 判断直线与线段相交 视野盲区
题目大意: 将所有物体抽象成一段横向的线段 给定房子的位置和人行道的位置 接下来给定n个障碍物的位置 位置信息为(x1,x2,y) 即x1-x2的线段 y相同因为是横向的 求最长的能看到整个房子的一段 ...
- 2019 Multi-University Training Contest 7 Kejin Player Final Exam
Kejin Player 期望DP 题意: 初始等级为1,每一级有四个参数 r , s , x , a . 每一级有一个概率p=r/s花费a的代价升级到下一级,失败可能会倒退到x级 设从 l 到 r ...
- Spoj-DISUBSTR - Distinct Substrings~New Distinct Substrings SPOJ - SUBST1~(后缀数组求解子串个数)
Spoj-DISUBSTR - Distinct Substrings New Distinct Substrings SPOJ - SUBST1 我是根据kuangbin的后缀数组专题来的 这两题题 ...
- docker上安装ActiveMQ
1.查看是否已经存在镜像 docker images 2.搜索镜像 docker search activemq 3.拉取镜像 docker pull webcenter/activemq 4.构建容 ...