#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define REP(i,n) for(ll i=0; i<(n); ++i) #define TEN(x) ((ll)1e##x) #define ALL(v) (v).begin(), (v).end() int main(){ ll n; cin >> n; vector a(n); vector b(n); for (auto&i : a) cin >> i; for (auto&i : b) cin >> i; using P = pair; ll min_c = 1501; REP(start, n){ priority_queue, greater

> que; for (auto&i : a) que.push({i, 0}); REP(i, n) { ll j = (i + start) % n; P p = que.top(); que.pop(); que.push({p.first+b[j]/2, p.second+1}); } priority_queue max_c; while(!que.empty()) { max_c.push(que.top().second); que.pop(); } min_c = min(min_c, max_c.top()); } cout << min_c << endl; return 0; }