#B3722. Cumulative Milk Sales Comparison
Cumulative Milk Sales Comparison
Cumulative Milk Sales Comparison
Farmer John is selling two types of milk: Type A and Type B. He has recorded sales data for n months for both types: \(a_1, a_2, \dots, a_n\) for Type A and \(b_1, b_2, \dots, b_n\) for Type B, where each \(a_i\) and \(b_i\) represents the number of boxes sold in the \(i\)-th month.
Your task is to determine the minimum number of months \(x\) such that the cumulative sales of Type B milk exceed the cumulative sales of Type A milk. In other words, find the smallest \(x\) for which \[ \sum_{i=1}^{x} a_i < \sum_{i=1}^{x} b_i. \]
inputFormat
The first line contains an integer \(n\) (the number of months). The second line contains \(n\) space-separated integers representing \(a_1, a_2, \dots, a_n\). The third line contains \(n\) space-separated integers representing \(b_1, b_2, \dots, b_n\).
outputFormat
Output a single integer: the minimum number of months \(x\) such that the cumulative sales of Type B milk exceed that of Type A milk.
sample
5
1 2 3 4 10
2 3 1 1 1
1
</p>