#include #include #include #include typedef std::pair P; //Lv,cnt typedef std::priority_queue< P, std::vector

, std::greater

> Q; int n; int a[1501], b[1501]; int ans = 100000000; int main(){ std::cin >> n; for (int i = 0; i < n; i++)std::cin >> a[i]; for (int i = 0; i < n; i++)std::cin >> b[i]; for (int i = 0; i < n; i++){ Q que; for (int j = 0; j < n; j++)que.push(P(a[j], 0)); for (int j = 0; j < n; j++){ int t = (i + j) % n; P p = que.top(); que.pop(); p.first += b[t] / 2; p.second++; que.push(p); } int max = 0; for (int i = 0; i < n; i++){ P p = que.top(); que.pop(); max = std::max(max, p.second); } ans = std::min(ans, max); } std::cout << ans << std::endl; return 0; }