Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Problem D
- n = int(input())
- inp = input().split(" ")
- people = [ int(x) for x in inp ]
- inp = input().split(" ")
- s, f = int(inp[0]), int(inp[1])
- r = f-s#+1 # tamaΓ±o de la ventana
- max_s, idx_max = sum( people[i] for i in range(r) ), 0
- sum_ac = max_s
- for j in range(n):
- # print(sum_ac, idx_max, res)
- sum_ac = sum_ac - people[j] + people[(r+j)%n]
- if sum_ac>=max_s:
- max_s, idx_max = sum_ac, (j+1)%n
- res = (n-idx_max+s)%n if (n-idx_max+s)%n else n
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement