信心赛??高考赛……

过程

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. Html+css3记录

    一.html5新特性  常用语义标签:nav footer header section mark  功能标签 video audio iframe canvas(画布和绘图功能)  input新ty ...

  2. day 65 Django基础十一之认证系统

    Django基础十一之认证系统   本节目录 一 auth模块 二 User对象 三 扩展默认的auth_user表 四 xxx 五 xxx 六 xxx 七 xxx 八 xxx 一 auth模块 我们 ...

  3. 【转载】一定要会用selenium的等待,三种等待方式必会

    转载地址:http://blog.csdn.net/huilan_same/article/details/52544521,感谢博文,学习了 原文: 发现太多人不会用等待了,博主今天实在是忍不住要给 ...

  4. adb 使用记录

    127.0.0.1:21503 adb kill -server adb start -server adb devices adb logcat | fing "cocos" a ...

  5. FileCloud 的原理简述&自己搭建文件云

    FileCloud 的原理简述&自己搭建文件云 copyright(c) by zcy 关于如何使用IIS创建asp服务,请读者自行研究 注:不要忘记添加入站规则 代码的存储: 根目录 fil ...

  6. android中实现监听的四种方法

    (1)自身类作为事件监听器 package cn.edu.gdmec.s07150745.work5; import android.support.v7.app.AppCompatActivity; ...

  7. Android开发 ViewPager删除Item后,不会更新数据和View

    问题描述: 在使用ViewPager的适配器删除适配器里一个Item后依然会,而删除的这个item依然会保留缓存,适配器不会重新加载更新数据.如下代码: public class TReleaseCi ...

  8. java char <-> int

    int = char - '0' or Character.getNumericValue(char ch) char = (char)int

  9. odoo 下 get_object_reference 函数

    get_object_reference是 ir.model.data 模块中下的一个函数 该函数通过调用ir.model.data 模块中另外一个函数 xmlid_lookup 返回结果 def g ...

  10. js '' ""的嵌套使用

    1.我需要拼接一个字符串,但是其中 单引号内包含了双引号,双引号内又包含了单引号变量 这时我们想到了可以用到HTML特殊转义字符 2.如下拼接 return '<input type=" ...