#include using namespace std; #define rep(i, j, n) for(int i=j;i pi; template using vt = vector; template using vvt = vector>; i64 gcd(int n, int m) {return (m == 0? n : gcd(m, n % m));} i64 lcm(int n, int m) {return (n / gcd(n, m) * m);} int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}; int dy[] = {1, 0, -1, 0, 1, -1, 1, -1}; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vt a(n), b(n); rep(i, 0, n) cin >> a[i]; rep(i, 0, n) cin >> b[i]; int ans = INF; rep(i, 0, n) { priority_queue, greater> que; rep(j, 0, n) que.push({a[j], 0}); rep(j, i, n) { pi p = que.top(); que.pop(); p.first += b[j] / 2; p.second++; que.push(p); } rep(j, 0, i) { pi p = que.top(); que.pop(); p.first += b[j] / 2; p.second++; que.push(p); } int num = 0; while(!que.empty()) { num = max(num, que.top().second); que.pop(); } ans = min(ans, num); } cout << ans << endl; }