信心赛??高考赛……

过程

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}$,一定被卡精度。

可以

  1. 化柿子,求斜率时用分式。
  2. 用$\frac{100000000\dots}{x}$
  3. 大骂出题人毒瘤

代码:

#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的更多相关文章

  1. 程序员的 Ubuntu 19.10 配置与优化指南

    原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...

  2. 背水一战 Windows 10 (15) - 动画: 缓动动画

    [源码下载] 背水一战 Windows 10 (15) - 动画: 缓动动画 作者:webabcd 介绍背水一战 Windows 10 之 动画 缓动动画 - easing 示例演示缓动(easing ...

  3. 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 ...

  4. 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 ...

  5. WTL汉化版2013.10.15

    汉化内容: 2013.10.15 版本:当前可下载Trunk最新版,wtl-code-467-trunk.zip 汉化内容: 1.应用向导的部分汉化,考虑到部分词汇的表述问题,只汉化无影响部分 2.资 ...

  6. [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 ...

  7. Datatables插件1.10.15版本服务器处理模式ajax获取分页数据实例解析

    一.问题描述 前端需要使用表格来展示数据,找了一些插件,最后确定使用dataTables组件来做. 后端的分页接口已经写好了,不能修改.接口需要传入页码(pageNumber)和页面显示数据条数(pa ...

  8. Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24

    作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...

  9. macOS 10.15 开启 HiDPI

    普通的显示,接上 MacBook 发现原生的分辨率设置在 2K 显示器上字体很小,换成 1080P 分辨率显示效果又特别模糊.下面介绍MacBook强行开启 HiDPI. 什么是 HiDPI 它使用横 ...

  10. 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 ...

随机推荐

  1. hdu多校第二场1009 (hdu6599) I Love Palindrome String 回文自动机/字符串hash

    题意: 找出这样的回文子串的个数:它本身是一个回文串,它的前一半也是一个回文串 输出格式要求输出l个数字,分别代表长度为1~l的这样的回文串的个数 题解: (回文自动机和回文树是一个东西) 首先用回文 ...

  2. Vue项目组织规范

    目录 一.项目结构的核心思想 二.项目目录结构 三.资源路径编译规则 四.index.html 五.build目录 和 config目录 六.public目录 七.static 目录 八.src目录结 ...

  3. ajax跨域请求使用代理

    public class ProxyHandler extends HttpServlet {    private static final long serialVersionUID = 1L;  ...

  4. 16.ajax_case09

    import requests import json import re from selenium import webdriver from selenium.webdriver.common. ...

  5. 一个上午,勉强记住了几种不同语言编译PE的启动函数

    VC:启动函数最乱,三大函数都在后面.前面8个PUSH DELPHI7:启动函数最整洁,2.3.4.2,形式排队 VB:启动函数最好记,12个0.... 汇编:三大函数距离最紧凑,除VB外,启动函数最 ...

  6. jsp 引入js、css修改后有缓存不及时更新

    解决:(增加随机版本号) <link rel="stylesheet" type="text/css" href="css/1.css?v=&l ...

  7. openSUSE 安装compass,mkmf.rb can't find,checking for ffi.h...extconf.rb failed

    安装compass时,提示 Fetching: sass-.gem (%) Successfully installed sass- Fetching: ffi-.gem (%) Building n ...

  8. bzoj1433 假期的宿舍

    题意:给你一些人可以睡某某人的床,问是否有所有人都睡下的方案?n<=50. 二分图最大匹配. 用邻接矩阵比较舒服. 标程: #include<cstdio> #include< ...

  9. 便携版Mysql安装

    目录 1.安装 0.Mysql下载地址 1.解压 2.在主目录下新建data和tempData两个文件夹 3.配置环境变量 4.配置my.ini 5.安装服务(管理员模式CMD) 6.清空data文件 ...

  10. Mac配置maven环境命令

    1.安装:解压下载好的maven的文件,解压到你想要的文件夹底下. 2.配置 1)打开终端输入命令 vim ~/.bash_profile (编辑环境变量配置文件) 2)按下i,进入编辑模式 3)在环 ...