#include #define rep(i,a,b) for(int i=int(a);i P; int INF = (1LL << 30) - 1; int MOD = 1e9+7; main(){ int N; cin >> N; vector A(N),B(N); rep(i,0,N)cin >> A[i]; rep(i,0,N)cin >> B[i]; int mini = INF; rep(i,0,N){ priority_queue< P, vector< P >, greater< P > > que; rep(j,0,N)que.push( P(A[j], 0) ); rep(j,0,N){ //next = (i + j) % N P p = que.top(); que.pop(); p.first += B[(i + j) % N] / 2; p.second ++; que.push(p); } int maxi = 0; while(!que.empty()){ P p = que.top(); que.pop(); maxi = max(maxi, p.second); } mini = min(mini, maxi); } cout << mini << endl; }