#include using namespace std; typedef pair P; int n; int a[1500], b[3000]; int calc(int a[], int b[]) { priority_queue, greater

> pq; for (int i = 0; i < n; i++){ pq.push(P(a[i], 0)); } int res = 0; for (int i = 0; i < n; i++){ int lv, ct; tie(lv, ct) = pq.top(); pq.pop(); pq.push(P(lv + b[i] / 2, ct + 1)); res = max(res, ct + 1); } return res; } int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i], b[i + n] = b[i]; int res = 1 << 28; for (int i = 0; i < n; i++){ res = min(res, calc(a, b + i)); } cout << res << endl; }