#include #define rep(i,n) for (int i = 0; i < (n); ++i) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; using P = pair; using VI = vector; using VVI = vector; int main() { int n; cin >> n; VI a(n), b(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; int ans = n; rep(s, n) { priority_queue,greater

> q; rep(i, n) q.emplace(a[i],0); int mx = 0; rep(j, n) { int ai, ci; tie(ai, ci) = q.top(); q.pop(); q.emplace(ai + b[(s+j)%n] / 2, ci + 1); chmax(mx, ci + 1); } chmin(ans, mx); } cout << ans << endl; }