B. The Meeting Place Cannot Be Changed

国产麒麟系统下Kettle安装避坑指南:解决aarch64架构不支持问题 本文详细解析了在国产麒麟系统上部署Kettle时遇到的aarch64架构不支持问题,提供了从获取适配的SWT库、修改启动脚本到生产环境调优的完整解决方案。文章重点解决了ARM架构与Java GUI工具的兼容性挑战,并分享了内存配置、字体显示及Carte服务部署等实战经验,助力用户在国产化环境中稳定运行ETL流程。 阅读详情

B. The Meeting Place Cannot Be Changed
time limit per test
5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction.

At some points on the road there are n friends, and i-th of them is standing at the point xi meters and can move with any speed no greater than vi meters per second in any of the two directions along the road: south or north.

You are to compute the minimum time needed to gather all the n friends at some point on the road. Note that the point they meet at doesn't need to have integer coordinate.

Input

The first line contains single integer n (2 ≤ n ≤ 60 000) — the number of friends.

The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) — the current coordinates of the friends, in meters.

The third line contains n integers v1, v2, ..., vn (1 ≤ vi ≤ 109) — the maximum speeds of the friends, in meters per second.

Output

Print the minimum time (in seconds) needed for all the n friends to meet at some point on the road.

Your answer will be considered correct, if its absolute or relative error isn't greater than 10 - 6. Formally, let your answer be a, while jury's answer be b. Your answer will be considered correct if  holds.

Examples
input
3
7 1 3
1 2 1
output
2.000000000000
input
4
5 10 3 2
2 3 2 4
output
1.400000000000
Note

In the first sample, all friends can gather at the point 5 within 2 seconds. In order to achieve this, the first friend should go south all the time at his maximum speed, while the second and the third friends should go north at their maximum speeds.


一个很水的二分,但因精度问题T3也很气。。

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define eps 1e-8
#define PI 3.141592653589793
#define bs 1000000007
#define bsize 256
#define MEM(a) memset(a,0,sizeof(a))
typedef long long ll;
using namespace std;
int x[60050],v[60050];
int n;
int check(double &t)
{
	int i;
	double le,ri;
	le=x[0]-v[0]*t;
	ri=x[0]+v[0]*t;
	for(i=1;i<n;i++)
	{
		le=max(le,x[i]-v[i]*t);
		ri=min(ri,x[i]+v[i]*t);
		if(ri<le)
		return 0;
	}
	return 1;
}
int main()
{
	double l,r,mid,ans;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&x[i]);	
	for(i=0;i<n;i++)
	scanf("%d",&v[i]);
	l=0,r=1e9;
	while(r-l>1e-7)
	{
		mid=(l+r)/2;
		if(check(mid))
		{
			r=mid;
			ans=mid;
		}
		else
		{
			l=mid;
		}
	}
	printf("%.10lf\n",ans);
	return 0;
 }


精度1e-8时,上面的代码会t,但下面这个基本一样的代码,区别就是把check放到主函数里,这个就可以过,在编译器运行test3都是无限循环(试了codeblocks和dev),可是交了就能过,很迷。。。。。。

3
1 1000000000 2
1 2 1000000000

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define eps 1e-8
#define PI 3.141592653589793
#define bs 1000000007
#define bsize 256
#define MEM(a) memset(a,0,sizeof(a))
typedef long long ll;
using namespace std;
int x[60050],v[60050];
int n;
int main()
{
	double l,r,mid,ans,m,le,ri;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&x[i]);	
	for(i=0;i<n;i++)
	scanf("%d",&v[i]);
	l=0,r=1e9;
	while(r-l>1e-8)
	{
		mid=(l+r)/2;
		int flog=1;
		le=x[0]-v[0]*mid;
		ri=x[0]+v[0]*mid;
		for(i=1;i<n;i++)
		{
			le=max(le,x[i]-mid*v[i]);
			ri=min(ri,x[i]+mid*v[i]);
			if(ri<le)
			{
				flog=0;
				break;
			}
		}
		if(flog)
		{
			r=mid;
			ans=mid;
	//		printf("%.9lf %.9lf\n",r,l);
		}
		else
		{
			l=mid;
		}
	}
	printf("%.10lf\n",ans);
	return 0;
 }




基因ID转换避坑指南:如何用org.Hs.eg.db把ENSEMBL ID变成可读的gene symbol 本文详细介绍了如何将RNA-seq等数据中常见的ENSEMBL ID转换为可读的基因符号(Gene Symbol),重点对比了biomaRt与org.Hs.eg.db两大工具的优劣,并深入剖析了多对多映射、版本号失效及非编码基因Symbol缺失三大核心陷阱。文章提供了针对TCGA、GEO等不同数据源的定制化处理方案与完整的稳健转换流程,帮助生物信息学分析者避免常见错误,确保下游分析的准确性。 阅读详情

相关推荐

TM1650数码管驱动芯片

简介 TM1650是一款国产4位共阴数码管驱动芯片,它还带有矩阵按键扫码功能。它的基本参数如下: 工作电压:3~5V 数码管驱动模式:8段x4位共阴数码管 矩阵按键驱动模式:7x4矩阵按键,不支持组合键 通信接口:类IIC,使用了IIC相同的时序,但没有完全遵守IIC的协议,不带从机地址 引脚定义 SCL:串行通信时钟线 SDA:串行通信数据线 做数码管驱动使用时 DIGx:数码管的位选引脚,灌电流驱动,最大可吸收150mA电流 A~DP:数码管的段驱动引脚,拉电流驱动,最大可输出25m

luliplus的博客 4万+

J - The Meeting Place Cannot Be Changed(走到一点花费时间最少)

原题:codeforces 780 题意: 给n个人的在数轴上的位置,已经他们移动的速度,求他们汇聚到一点的最小时间,eps为1e-6。 解析: 二分时间,对于每个时间,求出所有人,向左走这个时间后所在位置的最右值,向右走的最左值,看看是不是相交,不如不相交就说明不能在这个时间内汇聚到一点。 注意精度为1e-6,我开始的时候设成1e-12,在 3 \n 1 10000000...

QAQ 690

大模型-internvl高通qnn运行源码解读

模型链接:https://huggingface.co/OpenGVLab/InternVL2-2B论文官方简要说明 https://internvl.github.io/blog/2024-07-02-InternVL-2.0中文解读 https://zhuanlan.zhihu.com/p/702946079在线demo https://internvl.opengvlab.com/

点滴的岁月 1840

The Meeting Place Cannot Be Changed

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the road t...

小飞猪的博客 289

C# WinForm实战:用正运动ECI2418/2618卡实现4轴连续插补(附完整源码)

本文详细介绍了如何使用C# WinForm结合正运动ECI2418/2618运动控制卡实现4轴连续插补功能。从环境配置、核心架构设计到连续插补实现,提供了完整的开发流程和源码示例,帮助开发者快速掌握工业自动化领域的运动控制技术。

weixin_28454475的博客 153

Matlab结果性能评价---rms函数(计算矩阵、数组和向量元素均方根)

实例1:创建一个向量(正弦波)并计算其均方根值 实例2:创建一个二维矩阵并计算其均方根值 实例3:计算二维矩阵沿指定维度的均方根值 本例程配套完整源码下载 均方根(Root-Mean-Square Level): 向量x的均方根值为沿着指定的维度执行求和: 语法描述: y = rms(x)返回输入x的均方根值。如果x是行或列向量,y是实数值标量。对于大小尺寸大于1矩阵x,y包含沿x的第一个数组维度计算的均方根值。例如,如果x是N > 1的N*M矩阵,那么y是1*M行向量,对应x矩..

qq_32809093的博客 3万+

CodeForce-782B The Meeting Place Cannot Be Changed(高精度二分)

https://vjudge.net/problem/CodeForces-782B B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megabytes input standard input ou...

206

CH32V IAP跳转避坑指南:为什么你的APP跳不过去?从mstatus寄存器配置到函数属性详解

本文深入解析CH32V系列MCU的IAP跳转机制,从mstatus寄存器配置到函数属性优化,详细讲解如何避免APP跳转失败。文章涵盖地址准备、模式切换、跳转执行等关键步骤,并提供调试技巧与实战案例,帮助开发者快速解决CH32V IAP跳转中的常见问题。

weixin_30955617的博客 142

CodeForces 780B ——The Meeting Place Cannot Be Changed(二分法)

题意:        大致题意就是在一条数轴上,大家都有各自不同的坐标,然后每个人每秒移动速度不一样,每个人既可以往前也可以往后.问将所有人集中到一点所需的最短时间.解题思路:        对时间进行二分.        a[i]表示坐标,b[i]表示移动速度.        check部分思路:每个人在t时间内所能够移动的范围是【a[i]-b[i],a[i]+b[i]】,然后依次对每个人的移动...

lucius-liu.cn 523

【实战指南】RF-DETR多场景部署:从工业质检到自动驾驶的SOTA模型应用

本文深入解析了SOTA目标检测模型RF-DETR在工业质检与自动驾驶等多场景下的实战部署指南。该模型基于Transformer架构,在COCO数据集上实现了实时检测与高精度的突破,并凭借其强大的泛化能力,在RF100-VL等复杂数据集上表现出色。文章提供了从快速Demo、工业缺陷检测微调、车载自适应部署到多硬件平台性能优化的完整解决方案,帮助开发者高效应用这一先进模型。

weixin_29070861的博客 480

京东云鼎环境配置与API安全接入实战:ISV服务商如何搞定数据加密与商家授权

本文详细介绍了京东云鼎环境配置与API安全接入的实战指南,帮助ISV服务商解决数据加密与商家授权等核心问题。通过京东开放平台的应用申请流程,结合多租户数据隔离策略和自动化授权实现,确保电商生态中的安全高效运营。文章还提供了避坑指南,助力开发者规避常见配置错误。

weixin_28705087的博客 358

B. The Meeting Place Cannot Be Changed【二分】

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the road t...

slass-mot-odet 370

LabVIEW内存泄漏诊断与优化:从报错到高效运行

本文深入探讨LabVIEW内存泄漏的诊断与优化方法,从理解内存泄漏本质到使用专业工具链进行问题定位,再到高频场景的解决方案和高级优化策略。通过实战案例展示如何解决工业数据采集系统中的内存不足问题,帮助开发者提升LabVIEW应用的稳定性和效率。

moon9的博客 201

CF780B The Meeting Place Cannot Be Changed

洛谷评级就是辣鸡 原题地址:https://vjudge.z180.cn/problem/CodeForces-782B 题面: The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on t

qq_43070117的博客 349

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

codeforces B. The Meeting Place Cannot Be Changed【二分】

B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output The main road in Byt

博客已搬迁到http://www.cnblogs.com/cniwoq/ 581

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

codeforces 782B - The Meeting Place Cannot Be Changed

time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output The main road in Bytecity is a straight line from south to north

Dilthey's Blog 502

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

782B The Meeting Place Cannot Be Changed

题目链接:http://codeforces.com/contest/782/problem/B题解:题目大意:有N个人在一条从南到北的街上。给出每个人在这条街上的位置,以及每个人最大的移动的速度,让你选出一个点,使得每个人到这个点的时间最小。(注意:这里的点不一定是整数点) 可以用二分时间的思想去做(因为不是整数点),每次比较在这个时间的条件下,是不是能够使得所有的点都满足。(即:算出这个时间下

silver_bone的博客 275

【codeforces 782B】The Meeting Place Cannot Be Changed

【题目链接】:http://codeforces.com/contest/782/problem/B 【题意】 每个人都有一个速度,只能往上走或往下走; 然后让你找一个地方,所有人都能够在t时间内到达; 让t最小. 【题解】 很明显的二分了; 二分时间t; 对于某个时间t,这个人都有一个能够到达的唯一区间 [x[i]-v*t..x[i]+v...

169

【CodeForces 782B】 The Meeting Place Cannot Be Changed 二分

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the road there are n friends, and i-th of them is standing at the

待到山花烂漫时 227

CodeForces782B The Meeting Place Cannot Be Changed 三分查找

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the roa

Megumin的博客 493

B The Meeting Place Cannot Be Changed

#include<iostream> #include<cstdio> #include<vector> using namespace std; int num; struct node{ int x; int v; }; double min (double x, double y) { return x < y ? x : y; } double max (do

shadow 294

CodeForces - 782B The Meeting Place Cannot Be Changed

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the road

Tsaryu的博客 439

【Codeforces 782 B The Meeting Place Cannot Be Changed】+ 二分

B. The Meeting Place Cannot Be Changed time limit per test5 seconds memory limit per test256 megabytes inputstandard input outputstandard output The main road in Bytecity is a straight line from s

楚江枫 880
上一篇: Codeforces Round #403 (Div. 2) C. Andryusha and Colored Balloons dfs(树)
下一篇: CodeForces - 366C Dima and Salad
jerans
博客等级 码龄10年 54粉丝 255原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值