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");
}
}
}

CSU - 2062 Z‘s Array的更多相关文章

  1. CSU - 2061 Z‘s Coffee

    Description Z is crazy about coffee. One day he bought three cups of coffee. The first cup has a cap ...

  2. scala的多种集合的使用(5)之数组Array(ArrayBuffer)的操作

    1.创建和更新数组的不同方式 1)定义一个数组的初始大小和类型,随后填充值. scala> val array = new Array[String](3) array: Array[Strin ...

  3. numpy.array 合并和分割

    # 导包 import numpy as np numpy.array 的合并 .concatenate() 一维数组 x = np.array([1, 2, 3]) # array([1, 2, 3 ...

  4. java基础集合经典训练题

    第一题:要求产生10个随机的字符串,每一个字符串互相不重复,每一个字符串中组成的字符(a-zA-Z0-9)也不相同,每个字符串长度为10; 分析:*1.看到这个题目,或许你脑海中会想到很多方法,比如判 ...

  5. BZOJ3160万径人踪灭

    Description Input & Output & Sample Input & Sample Output HINT 题解: 题意即求不连续但间隔长度对称的回文串个数. ...

  6. 迷你MVVM框架 avalonjs 入门教程

    新官网 请不要无视这里,这里都是链接,可以点的 OniUI组件库 学习教程 视频教程: 地址1 地址2 关于AvalonJs 开始的例子 扫描 视图模型 数据模型 绑定 作用域绑定(ms-contro ...

  7. LDA的Python实现源码

    #-*- coding:utf-8 -*- import logging import logging.config import ConfigParser import numpy as np im ...

  8. Lua 与 Redis

    Lua 与 Redis 标签: Java与NoSQL 从 2.6版本 起, Redis 开始支持 Lua 脚本 让开发者自己扩展 Redis - 案例-实现访问频率限制: 实现访问者 $ip 在一定的 ...

  9. 制作简单的2D物理引擎(一)——动力学基础

    一切的基础 点 在二维平面中,点$P$就是坐标$(x,y)$,点集就是一系列坐标的集合$\{P_1,P_2,...,P_n\}$,不过这个集合是有序的(顺时针). 向量 加减运算 $$\vec{P}\ ...

随机推荐

  1. JavaScript - Scope of variables

    It's important to note, especially if you have come to JavaScript from another language, that variab ...

  2. ArraySizeHelper解析

    [ArraySizeHelper解析] 以下代码用于获取一个数组的元素个数,例如 int table[100],以下宏返回100. template <typename T, size_t N& ...

  3. 20155231 2016-2017-2 《Java程序设计》第8周学习总结

    20155231 2016-2017-2 <Java程序设计>第8周学习总结 教材学习内容总结 学习目标 了解NIO 会使用Channel.Buffer与NIO2 会使用日志API.国际化 ...

  4. Trying to get property of non-object

    原文:http://www.jb51.net/article/29878.htm 总结:判断为空用 if(isset($v)){}代替if($v == null){}

  5. 灰色预测 GM11模型

    灰色预测实现见:https://www.jianshu.com/p/a35ba96d852b from pandas import Series from pandas import DataFram ...

  6. Python文件操作-文件的增删改查

    需求:对文件进行增删改查 由于时间原因,本次代码没有增加任何注释,如有疑问,请联系编辑者:闫龙 其实我也是醉了,看着这些个代码,我脑袋也特么大了,没办法,大神说了,不让用新知识,只可以使用学过的,所以 ...

  7. 使用idea的的第一个坑-----javax.xml.ws.WebServiceRef

    新建项目启动报错的时候,一直报这个错,类找不到,郁闷了半天,都没百度到结果,后来发现是添加tomcat的时候jre没 指定..... 哈哈哈,太懵逼了,指定就ok了

  8. linux编译警告 will be initialized after

    http://blog.chinaunix.net/uid-17019762-id-3152012.html 作为一个有强迫症的人,实在是受不了 warning 的存在 这个warning是由于初始化 ...

  9. 一、Vue入门

    vue官网:https://cn.vuejs.org/ 学习路线:VueJs2.0建议学习路线 在浏览器上安装 Vue Devtools工具 1.vue入门 <script src=" ...

  10. 十二、springboot之web开发之静态资源处理

    springboot静态资源处理 Spring Boot 默认为我们提供了静态资源处理,使用 WebMvcAutoConfiguration 中的配置各种属性. 建议大家使用Spring Boot的默 ...