#include<stdio.h>

#include<stdlib.h>

int cmp(const void *a,const void *b) {

return *(int *)a-*(int *)b;

}

int main() {

  int n,m,i,a[3100],flag;

  while(scanf("%d%d",&n,&m)!=EOF) {

 for(i=0;i<m;i++)

 scanf("%d",&a[i]);

 qsort(a,m,sizeof(a[0]),cmp);

 flag=0;

 if(a[0]==1||a[m-1]==n) {

 printf("NO\n");

 continue;

 }

 for(i=2;i<m;i++) 

 if(a[i]-1==a[i-1]&&a[i-1]-1==a[i-2]) {

 flag=1;

 break;

 }

 if(flag==0) 

 printf("YES\n");

 else

 printf("NO\n");

 }

 return 0;

  }

codeforces 362B的更多相关文章

  1. CodeForces 362B Petya and Staircases

    题意:一个小男孩要上楼梯,他一次可以走1个台阶或2个台阶或3个台阶,但是有一些台阶是脏的,他不想走在脏台阶上.一共有n个台阶和m个脏台阶,他最开始在第1个台阶上,要走到第n个台阶.问小男孩能不能不踩到 ...

  2. codeforces362B

    Petya and Staircases CodeForces - 362B 题意: 一个小男孩要上楼梯,他一次可以走1个台阶或2个台阶或3个台阶,但是有一些台阶是脏的,他不想走在脏台阶上.一共有n个 ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. break跳出嵌套循环体

    package com.wh.Object; public class Test { public static void main(String[] args) { // TODO Auto-gen ...

  2. java中实参与形参的概念

    形参: public void fun(形参类型 形参名){ ... } 实参: public static void main(String[] args){ 类 对象名=new 类(); 对象名. ...

  3. Android最简单的实例 :环境搭建及HelloWorld

    Android开发之旅:环境搭建及HelloWorld 2010-04-12 00:45 by 吴秦, 883961 阅读, 140 评论, 收藏,  编辑 ——工欲善其事必先利其器 引言 本系列适合 ...

  4. E. Dasha and Puzzle 数学题

    http://codeforces.com/contest/761/problem/E 给出一颗树,要求在坐标系中用平行于坐标轴的线描绘出来. 要求边不能相交,而且点的坐标唯一. 注意到2^1 + 2 ...

  5. DEV—【GridControl添加按钮列】

    效果图 打开GridControl的Run Designer在左侧栏中找到: 添加一个ButtonEdit: 更改属性中的值:Caption为按钮上显示的Text:Kind为按钮的类型: 然后拖到最后 ...

  6. [转]Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application (3 of 10)

    本文转自:http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/sorting-fi ...

  7. android开发学习——android studio 引入第三方库的总结

    http://www.jianshu.com/p/0c592fff5d89 总结的很溜

  8. Java中static修饰符

    public class StaticTest { static int i ; static int m=30; int j ; int k=25; static{ i=10; System.out ...

  9. poj2991 Crane

    思路: 线段树每个节点维护第一条线段起点指向最后一条线段终点的向量,于是每一个操作都是一次区间更新.使用成段更新的线段树即可.实现: #include <cstdio> #include ...

  10. 6 Specialzed layers 特殊层 第一部分 读书笔记

    6 Specialzed layers 特殊层  第一部分  读书笔记   Specialization is a feature of every complex organization. 专注是 ...