|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||2||2||2||100.000%|
Did you know that Greg practices his Swedish skills every day? Well, almost every day.
The app that Greg uses to learn languages gives out achievement badges to keep you engaged with the app. One of the achievements is for the longest streak, i.e., the highest number of consecutive days that Greg practices Swedish. Remember that Greg does not practice every day, so there are gaps. Fortunately, the app allows him to pay for the days where he did not practice and still obtain the achievement.
Given the days when Greg actually practiced his Swedish and the number of days he is willing to pay for, what is the longest streak he can reach?
The input consists of:
Output the length of the longest streak that Greg can reach when using the paid days in an optimal way.
5 2 3 5 6 10 11
2 2018 42 424242