#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a &t,vector &u,vector &ans){ double p=0; rep(i,k){ double now=0; vector x(n); rep(ii,n){ ll a=(t[i]-(ans[ii]+1))/(ans[ii]*2); ll b=(t[i]-(ans[ii]+1))%(ans[ii]*2); if(a%2==0){ x[ii]=ans[ii]-1-b; }else{ x[ii]=-ans[ii]+1+b; } } rep(ii,n-1){ for(ll jj=ii+1;jj x(n); rep(ii,n){ ll a=(t[i]-(ans[ii]+1))/(ans[ii]*2); ll b=(t[i]-(ans[ii]+1))%(ans[ii]*2); if(a%2==0){ x[ii]=ans[ii]-1-b; }else{ x[ii]=-ans[ii]+1+b; } } rep(ii,n-1){ for(ll jj=ii+1;jj> n >> k; vector t(k),u(k); rep(i,k) cin >> t[i]; rep(i,k) cin >> u[i]; ll xxx=n; vector ans(n,xxx); ll max_score=score(t,u,ans); mt19937 mt(rand()); double time_limit=1.91; while(true){ double now=clock(); if(time_limit<(now-start)/CLOCKS_PER_SEC) break; ll x=mt()%n; ll h=ans[x]; ans[x]=mt()%(xxx-1)+1; ll now_score=score(t,u,ans); double now_second=now/CLOCKS_PER_SEC; double start_second=start/CLOCKS_PER_SEC; double temp=1000-900*(now_second-start_second)/time_limit; double prob=exp((now_score-max_score)/temp); if(1.0*(double)mt()/(double)(1ll<<32)