Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

题目连接:

http://codeforces.com/contest/985/problem/E

Description

Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is of the same color and only saturation differs. This pack can be represented as a sequence a1, a2, ..., an of n integer numbers — saturation of the color of each pencil. Now Mishka wants to put all the mess in the pack in order. He has an infinite number of empty boxes to do this. He would like to fill some boxes in such a way that:

  • Each pencil belongs to exactly one box;
  • Each non-empty box has at least k pencils in it;
  • If pencils i and j belong to the same box, then |ai - aj| ≤ d, where |x| means absolute value of x. Note that the opposite is optional, there can be pencils i and j such that |ai - aj| ≤ d and they belong to different boxes.

Help Mishka to determine if it's possible to distribute all the pencils into boxes. Print "YES" if there exists such a distribution. Otherwise print "NO".

Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes的更多相关文章

  1. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  2. Educational Codeforces Round 44 (Rated for Div. 2)

    题目链接:https://codeforces.com/contest/985 ’A.Chess Placing 题意:给了一维的一个棋盘,共有n(n必为偶数)个格子.棋盘上是黑白相间的.现在棋盘上有 ...

  3. Educational Codeforces Round 44 (Rated for Div. 2) F - Isomorphic Strings

    F - Isomorphic Strings 题目大意:给你一个长度为n 由小写字母组成的字符串,有m个询问, 每个询问给你两个区间, 问你xi,yi能不能形成映射关系. 思路:这个题意好难懂啊... ...

  4. [Educational Codeforces Round 81 (Rated for Div. 2)]E. Permutation Separation(线段树,思维,前缀和)

    [Educational Codeforces Round 81 (Rated for Div. 2)]E. Permutation Separation(线段树,思维,前缀和) E. Permuta ...

  5. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  6. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  7. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  8. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  9. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

随机推荐

  1. CSS 背景图像 background属性简写

    background属性简写 background属性可以像margin padding属性一样,有简写方法,它的简写顺序是: background-color background-image ba ...

  2. servlet实现mysql数据库分页

    一.分页所需要的sql语句准备 select * from table limit m,n其中m是指记录开始的index,从0开始,表示第一条记录n是指从第m+1条开始,取n条. 例如:select ...

  3. Windows Server 2012 R2 双网卡绑定

    双网卡绑定主要有以下两点好处: 1.实现网络容错:主主模式和主被模式 2.带宽聚合 首先准备工作需要两台虚拟机,Server01是目标服务器,需要有两块网卡,并且清空两块网卡的现有配置,Server0 ...

  4. 算法练习LeetCode初级算法之设计问题

    打乱数组 不断的让第一个与后面随机选择的数交换 class Solution { private int[] nums; private int[] initnums; public Solution ...

  5. B/S架构与C/S架构

    一,概念:        首先软件体系结构定义了软件的局部和总体计算的构成,以及这些部件之间的相互作用关系.部件包括诸如服务器,客户,数据库,过滤器,程序包,过程,子程序等一切软件的 组成成分. C/ ...

  6. Java创建对象的初始化顺序

    1. 初始化块 初始化块通常写在类的构造方法之前,由花括号括起来,通常包含对成员属性进行初始化的语句: 初始化块分为instance初始化块和static初始化块,初始化块在构造方法执行之前被执行: ...

  7. Kubernetes节点维护

    1.设置节点为不可调度 kubectl cordon $NODENAME 2.使用kubectl drain优雅的结束节点上的所有 pod 并同时标记节点为不可调度 kubectl drain $NO ...

  8. java 小数转换成二进制

    32位单精度二进制 = [1个符号位] [8个阶码位] [23个尾数位] 64位单精度二进制 = [1个符号位] [11个阶码位] [52个尾数位] 小数 = [正负符号位]  [整数部分] . [小 ...

  9. laraval migration 新增字段或者修改字段的方法

    1.进入项目根目录执行artisan命令生成migration文件,可以指定--table和--path参数,会在对应目录下生成migration文件. php artisan make:migrat ...

  10. hashmap源码研究

    概述 在官方文档中是这样描述HashMap的: Hash table based implementation of the Map interface. This implementation pr ...