## 03 Jul Tuesday Python Homework 18:30 – 22.06.28.

**Question:**

Annie has two favourite baseball teams: the Eagle and the Warrior. She has followed them throughout the season, which is now over. The season lasted for ** N** days. Both teams played exactly one game on each day.

For each day, Annie recorded the number of runs scored by the Eagle on that day. She also recorded this information for the Warrior.

She would like you to determine the largest integer ** K** such that

**≤**

*K***and the Eagle and the Warrior had scored the same total number of runs**

*N***days after the start of the season. The total number of runs scored by a team after**

*K**days is the sum of the number of runs scored by the team in all games before or on the*

**K****-th day.**

*K*For example, if the Eagle and the Warrior have the same total number of runs at the end of the season, then you should output ** N**. If the Eagle and the Warrior never had the same number of runs after

**games, for any value of**

*K***≤**

*K***, then output 0.**

*N***Input Specification**

The first line of input will contain an integer ** N** (1 ≤

**≤ 100 000). The second line will contain**

*N***space-separated non-negative integers representing the number of runs scored by the Eagle on each day, in order. The third line will contain**

*N***space-separated non-negative integers representing the number of runs scored by the Warrior on each day, in order. You may assume that each team scored at most 20 runs in any single game.**

*N*For 7 of the 15 points available,

**≤ 1000.**

*N***Output Specification**

Output the largest integer * K* such that

*≤*

**K****and the Eagle and the Warrior have the same total number of runs after**

*N***days.**

*K*Sample Input 13 1 3 3 2 2 6Output for Sample Input 12Explanation for Output for Sample Input 1After 2 days, each team had scored a total of 4 runs.`

Sample Input 23 1 2 3 4 5 6Output for Sample Input 20Explanation for Output for Sample Input 2The only time when the Eagle and the Warrior had scored the same number of runs was the beginning of the season.

Sample Input 34 1 2 3 4 1 3 2 4Output for Sample Input 34Explanation for Output for Sample Input 3The Eagle and Warrior have the same number of total runs after the first game, and after the third game, and after the fourth game. We take the largest of these values (1, 3 and 4) and output 4.

Sorry, the comment form is closed at this time.