/******************************************
* AUTHOR : kevin_007 *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define Speed_UP ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
clock_t clk=clock();
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> pt;
#define vi vector<int>
#define vll vector<ll>
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define repe(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define sz(x) ((int)(x).size())
#define F first
#define S second
template<class T> using ordered_set = tree<T, null_type, less_equal<T>,
rb_tree_tag,tree_order_statistics_node_update> ;
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
pt func(pt a, pt b) {
if(b.F>a.S or b.S<a.F) return {-1,-1};
return {max(a.F,b.F), min(a.S, b.S)};
}
int solve(){
int n; cin>>n;
vll x(n), t(n); rep(i,n) cin>>x[i];
rep(i,n) cin>>t[i];
ld low=0, hi=MOD;
ld mid;
ll itr=30;
ld ans=0;
while(itr-- and low<=hi) {
mid=(low+hi)/2;
bool ok=1;
pt full = {0, MOD};
rep(i,n) {
if(mid<t[i]) {
ok=0; break;
}
// Here Changing ld to ll gives correct answer
ld diff = mid - t[i];
pt temp = {x[i] - diff, x[i] + diff};
full = func(temp, full);
if(full.F==-1) {
ok=0; break;
}
}
if(!ok) {
low=mid;
}
else {
hi=mid;
ans = (full.F+full.S)/2.0;
}
}
cout<<setprecision(12) << fixed << ans<<"\n";
return 0;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
Speed_UP
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqIEFVVEhPUiA6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AgICAgICBvaz0wOyAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZighb2spIHsKICAgICAgICAgICAgbG93PW1pZDsgIAogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgaGk9bWlkOyAgIAogICAgICAgICAgICBhbnMgPSAoZnVsbC5GK2Z1bGwuUykvMi4wOwogICAgICAgIH0KICAgIH0KCiAgICBjb3V0PDxzZXRwcmVjaXNpb24oMTIpIDw8IGZpeGVkIDw8IGFuczw8IlxuIjsKCiAgICByZXR1cm4gMDsKfQoKaW50IG1haW4oKSB7CiAgICAjaWZuZGVmIE9OTElORV9KVURHRSAgIAogICAgZnJlb3BlbigiaW5wdXQudHh0IiwgInIiLCBzdGRpbik7IAogICAgLy8gZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KTsgICAgCiAgICAjZW5kaWYgCiAgICBTcGVlZF9VUAoKCiAgICBpbnQgdDsKICAgIGNpbj4+dDsKCiAgICB3aGlsZSh0LS0pewogICAgICAgIHNvbHZlKCk7CiAgICB9CgogICAgcmV0dXJuIDA7Cgp9