Editorial for 第2回卬高杯 C問題 - Colorful Note
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Python
Python3
N,k=map(int,input().split())
A=[*map(int,input().split())]
ad=1
ans=sum(A[:k])
now=sum(A[:k])
for i in range(N):
d=A[(k+i)%N]-A[i]
if now+d>ans:
ans=now+d
ad=i+2
now+=d
print(ad,ans)
Comments