AdvancedRating 1500
Round Trip
A circular route has gas[i] fuel at station i and cost[i] to reach the next one. Print the starting station that lets you complete the circle, or -1 (the answer is unique if it exists).
Input
n, a line of gas, a line of cost.
Output
An index or -1.
Sample 1
Input
5 1 2 3 4 5 3 4 5 1 2
Output
3
Sample 2
Input
3 2 3 4 3 4 3
Output
-1
Output appears here