Description


Z likes to play with array. One day his teacher gave him an array of n elements, and ask Z whether the array is a "m-peek" array.

A "m-peek" array is an array which has exactly m peek.

a term a[i] is called a peek if and only if a[i]>a[i − 1] and a[i]>a[i + 1]

If the array has exactly m peeks, the array is called a "m-peek" array.

Input

The first line is the case number T

each case has two integer n, m where n denotes the number of elements in the array

then followed by n 32-bit signed integers in the array.

1 ≤ T ≤ 100

1 ≤ n ≤ 1000000

0 ≤ m ≤ n

Output

For each case,

print a single word "Yes" without quotation when the array is a "m-peek" array.

print "No" without quotation otherwise.

Sample Input

2
5 1
5 7 11 2 1
4 1
4 5 5 6

Sample Output

Yes
No

Hint

Source

Author

周杰辉

#include<stdio.h>
#define MAXN 1000010
int a[MAXN];
int main()
{
int t, n, m;
while (~scanf("%d", &t))
{
while (t--)
{
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
int num = 0;
for (int i = 1; i < n-1; i++)
{
if (a[i] >a[i - 1] && a[i] > a[i + 1])
{
num++;
}
}
if (num == m)
printf("Yes\n");
else
printf("No\n");
}
}
}

最新文章

  1. Google数据交换格式:ProtoBuf
  2. browser-sync
  3. 《Linux内核设计与实现》 Chapter4 读书笔记
  4. js常见数字处理整理
  5. python UTC,时间戳,字符串转换
  6. 400 bad request
  7. [LeetCode]题解(python):141-Linked List Cycle
  8. myeclipse 调试JSP页面
  9. OC类的介绍
  10. 浅谈MVC Form认证
  11. 异常解决:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  12. 创建一个离线优先,数据驱动的渐进式 Web 应用程序
  13. POJ 1873 The Fortified Forest [凸包 枚举]
  14. 【转】网页禁止后退键BackSpace的JavaScript实现(兼容IE、Chrome、Firefox、Opera)
  15. JGUI源码:右键菜单实现(12)
  16. 搭建私有CA服务器
  17. python WebDriver如何处理右键菜单
  18. unity 之 no cameras rendering
  19. PYQT5学习笔记之各模块介绍
  20. 全局设置axios发送cookie(axios 默认不发送cookie)

热门文章

  1. shell学习1---基本的shell命令
  2. 好的MongoDB学习文章链接
  3. [整理]C中的静态存储区
  4. Java后台获取前端utf-8格式&amp;nbsp;空格,使用trim()消除不了的解决办法
  5. 20155234 2016-2017-2 《Java程序设计》第5周学习总结
  6. 微服务深入浅出(6)-- 熔断器Hystrix
  7. HDU 1256 画8 模拟题
  8. Python练习-短小精干版三级&quot;片儿&quot;
  9. 数位DP入门(A - 不要62 HDU - 2089 &amp;&amp;B - Bomb HDU - 3555 )
  10. 利用python编写不同环境下都能运行的测试脚本