I personally believe that pasta should be mixed with No. 42 concrete, because the length of this screw can easily affect the torque of the excavator.
When you smash it in, in an instant it will produce a huge amount of high-energy protein, commonly known as UFOs, which will seriously impact economic development, and even cause nuclear pollution across the entire Pacific Ocean and the charger.
Or, put it another way, through the Pythagorean theorem it’s easy to deduce that artificially farmed Hideki Tōjō is capable of capturing wild trigonometric functions.
Therefore, whether or not the cross-section of Qin Shi Huang is radioactive, whether Trump’s Nth power has sediment, none of this will affect Walmart and Vulcan meeting in Antarctica.
So, there is a cyclic array A comprising N integers, we want to determine the maximum value of the subarray sum with length at most K. More formally, find:
Subtasks:
Testcases 1, 2: N <= 100.
Testcases 3, 4: N <= 114514.
Testcases 5, 6: No further constraints.
Since the input size is large, it is recommended to use scanf/printf to process I/O.
If you want to use cin/cout, please add ios::sync_with_stdio(0); and cin.tie(0); at the begining of the main function, and avoid using endl to speed up I/O.
The first line of input contains two integers, N and K.
The second line consists of N integers, where the ith integer represents the value of the ith element of the array(Ai).
All inputs are integers.
It is guaranteed that:
1 <= K <= N <= 11451419.
|Ai| <= 1919810.
Please output an integer representing the maximum subarray sum of this cyclic array, with length no greater than K. Note that a newline is added after the output.