#include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n), b(n); for (int i = 0; i < n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); int ans = 1e9; for (int start = 0; start < n; start++) { priority_queue, vector>, greater>> pq; for (int i = 0; i < n; i++) pq.push(make_pair(a[i], 0)); for (int add = 0; add < n; add++) { int now = (start + add) % n; auto [level, count] = pq.top(); pq.pop(); level += b[now] / 2; count++; pq.push(make_pair(level, count)); } int countmax = 0; while (!pq.empty()) { auto [level, count] = pq.top(); pq.pop(); countmax = max(countmax, count); } ans = min(ans, countmax); } cout << ans << '\n'; }