#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include "bits/stdc++.h" #define REP(i,a,b) for(int i=a;i> a;}; template void reader(T& t, U& u) { reader(t); reader(u); } template void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); } void writer(const int a, char c) { printf("%d", a); putchar(c); } void writer(const ll a, char c) { printf("%lld", a); putchar(c); } void writer(const ull a, char c) { printf("%llu", a); putchar(c); } void writer(const double a, char c) { printf("%.20lf", a); putchar(c); } void writer(const char a[]) { printf("%s", a); }; void writer(const char a[], char c) { printf("%s", a); putchar(c); }; void writer(const char a, char c) { putchar(a); putchar(c); }; template void writerLn(T t) { writer(t, '\n'); } template void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); } template void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); } template void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); } template void writerVec(vector x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); } vector split(const string &str, char sep) { vector v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; } // #define int ll bool test = 1; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; #define MAX 300000 //..................... ull mod = (int)1e9 + 7; #define P pair signed main(void) { int sum = 0; int N; int a[1500]; int b[1500]; cin >> N; rep(i, N) reader(a[i]); rep(i, N) reader(b[i]); int ans = INT_MAX; priority_queue, greater

> start; rep(j, N) { start.push(make_pair(a[j], 0)); } rep(i, N) { priority_queue, greater

> pq = start; // first : level , second : 戦った回数 rep(j, N) { auto now = pq.top(); pq.pop(); now.first += b[(i + j) % N] / 2; ++now.second; pq.push(now); } int ansi = 0; while (pq.size()) { if (ansi < pq.top().second) { ansi = pq.top().second; } pq.pop(); } if (ans > ansi) ans = ansi; } cout << ans << endl; return 0; }