#include using namespace std; #define rep(i,a,b) for(ll i=a;i=b;i--) #define ll long long #define ull unsigned ll #define ld long double #define bl __int128_t #define fi first #define se second #define vel vector #define vvel vector #define pll pair #define vepll vector #define vvepll vector #define ves vector #define vem vector #define vvem vector #define pmm pair #define cleout(i) cout<using PQ=priority_queue,greater>; // 上 右 下 左 vector di={-1, 0, 1, 0}; vector dj={ 0, 1, 0,-1}; vector dx={ 0, 1, 0,-1}; vector dy={ 1, 0,-1, 0}; vector ddx={ 1, 1, 1, 0, -1, -1, -1, 0 }; vector ddy={ 1, 0, -1, -1, -1, 0, 1, 1 }; ll inf=1000000000000000000;//1e18 // LLONG_MAX mt19937_64 rng((ull)chrono::steady_clock::now().time_since_epoch().count()); //[x^M]1/(1-x)^N=comb(N-1+M,M) struct info{ ld now; ld ml,mr; info(ld NOW=0,ld ML=-inf,ld MR=-inf){ now=NOW; ml=ML; mr=MR; } }; struct Combine { inline info operator()(const info &a,const info &b)const{ info res(a.now+b.now,max(b.ml,b.now+a.ml),max(a.mr,a.now+b.mr)); return res; } }; template struct seg{ int N; Combine combine; T id; vector node; int sz; seg(vector &a,Combine com,T ident){ sz=a.size(); combine=com; id=ident; ll m=1; while(m0){ i/=2; node[i]=combine(node[2*i],node[2*i+1]); } } inline T Ique(int l,int r){//[a,b)のmin T resl=id,resr=id; l+=N; r+=N; while(l int upper(int l,T x,F check){//check(node[now],x)=1の最小のindex if(l>=sz)return sz; l+=N; T now=id; do{ while(l%2==0)l>>=1;//左にいるなら区間を大きくする if(check(combine(now,node[l]),x)){//この区間でhitしてる while(l inline int lower(int r,T x,F check){//check(node[now],x)=1の最大のindex if(r<=0)return -1; r+=N; T now=id; do{ r--; while(r>1&&(r%2))r>>=1;//右側にいるなら区間を大きくする if(check(combine(node[r],now),x)){ while(r>N; vel a(N),b(N); rep(i,0,N)cin>>a[i]; rep(i,0,N)cin>>b[i]; ld ng=0; ld ok=inf; while(ok-ng>0.0000001){ ld mid=(ok+ng)/2; auto check=[&](){ info id; seg st(N,Combine(),id); rep(i,0,N){ info now((ld)a[i]-mid*(ld)b[i],(ld)a[i]-mid*(ld)b[i],(ld)a[i]-mid*(ld)b[i]); st.chan(i,now); } bool ok=0; rep(i,0,N){ ld L=0; if(i>0)L=st.Ique(0,i).ml; ld R=st.Ique(i,N).mr; if(L+R<0)ok=1; } return ok; }; if(check())ok=mid; else ng=mid; } cleout(16); cout<>_; else _=1; rep(__,0,_){ _solve(); } }