P27058 [AtCoder] Segtree☆Magica
省选
题目描述

Problem Description

Score: 700 points

Tepris, a magical girl, has obtained a magical wand called "Segtree". Frustrated with her low-quality impersonators, Tepris decides to use this wand to defeat them.
There are $ N $ impersonators lined up in a straight line, numbered from 1 to $ N $ from left to right. The health of the $ i $-th impersonator is $ A_i $. Tepris can hit any impersonator with a number between $ K $ and $ N-K+1 $ (inclusive) in any order and any number of times.
Segtree is a ranged attack weapon. When Tepris hits the $ x $-th impersonator with Segtree, the $ y $-th impersonator takes $ max(0, K-|x-y|)^2 $ damage.
Tepris is a good angel and will not attack in a way that reduces an opponent's health to less than zero. Determine if it is possible for Tepris to defeat all opponents, i.e., reduce the health of all opponents to exactly zero, while adhering to this condition.

Input Format

The input is given from the standard input in the following format:

$ N $ $ K $ $ A_1 $ $ A_2 $ $ ... $ $ A_{N-1} $ $ A_N $

Output Format

Output Yes if it is possible to reduce the health of all opponents to exactly zero, otherwise output No.

Sample Input and Output

Sample Input #1

8 3
1 4 10 9 14 13 5 1

Sample Output #1

Yes

Sample Input #2

6 3
8 6 9 1 2 1

Sample Output #2

No

Sample Input #3

16 4
2 9 22 41 34 20 20 37 71 72 55 36 15 5 1 0

Sample Output #3

Yes

Notes/Hints

Constraints

  • All inputs are integers.
  • $3 \leq N, K \leq 133,333$
  • $2K-1 \leq N$
  • $0 \leq A_i \leq 10^{13}$

Sample Explanation 1

For example, if Tepris hits the 3rd, 5th, and 6th impersonators in this order with Segtree, the health values change as follows:
- First, hit the 3rd impersonator. The health values change to $ {0, 0, 1, 5, 13, 13, 5, 1} $.
- Next, hit the 5th impersonator. The health values change to $ {0, 0, 0, 1, 4, 9, 4, 1} $.
- Finally, hit the 6th impersonator. The health values change to $ {0, 0, 0, 0, 0, 0, 0, 0} $.
By hitting in this manner, Tepris can reduce the health of all impersonators to exactly zero.

Sample Explanation 2

No matter how Tepris hits, it is impossible to reduce the health of all impersonators to exactly zero.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
8 3 1 4 10 9 14 13 5 1
样例输出
Yes