#include #include #include using namespace std; int main(){ int n; cin >> n; int a[n], b[n]; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < n; i++) cin >> b[i]; int ans = 1 << 30; for(int i = 0; i < n; i++){ priority_queue, vector>, greater>> pq; // first -> レベル, second -> 何回戦ったか for(int j = 0; j < n; j++) pq.push({a[j], 0}); for(int j = 0; j < n; j++){ pair p = pq.top(); pq.pop(); pq.push({p.first + b[(i + j) % n] / 2, p.second + 1}); } int tmp = 0; while(!pq.empty()){ tmp = max(tmp, pq.top().second); pq.pop(); } ans = min(ans, tmp); } cout << ans << endl; }