Description

The factory of the Impractically Complicated Products Corporation has many manufacturing lines and the same number of corresponding storage rooms. The same number of conveyor lanes are laid out in parallel to transfer goods from manufacturing lines directly to the corresponding storage rooms. Now, they plan to install a number of robot arms here and there between pairs of adjacent conveyor lanes so that goods in one of the lanes can be picked up and released down on the other, and also in the opposite way. This should allow mixing up goods from different manufacturing lines to the storage rooms. Depending on the positions of robot arms, the goods from each of the manufacturing lines can only be delivered to some of the storage rooms. Your task is to find the number of manufacturing lines from which goods can be transferred to each of the storage rooms, given the number of conveyor lanes and positions of robot arms

Input

The input consists of a single test case, formatted as follows.
n m
x1 y1
.
.
.
xm ym
An integer n (2 ≤ n ≤ 200000) in the first line is the number of conveyor lanes. The lanes are numbered from 1 to n, and two lanes with their numbers differing with 1 are adjacent. All of them start from the position x = 0 and end at x = 100000. The other integer m (1 ≤ m < 100000) is the number of robot arms. The following m lines indicate the positions of the robot arms by two integers xi (0 < xi < 100000) and yi (1 ≤ yi < n). Here, xi is the x-coordinate of the i-th robot arm, which can pick goods on either the lane yi or the lane yi + 1 at position x = xi , and then release them on the other at the same x-coordinate. You can assume that positions of no two robot arms have the same x-coordinate, that is, xi ≠≠ xj for any i ≠≠ j

Output

Output n integers separated by a space in one line. The i-th integer is the number of the manufacturing lines from which the storage room connected to the conveyor lane i can accept goods.

Sample Input

4 3
1000 1
2000 2
3000 3

Sample Output

2 3 4 4

这个题目我觉得就是思维题,需要找规律,有两个小规律,一个就是两条生产线之间的物品可以交换,不过这个要按照x坐标排一下顺序,只有一部分可以交换,这个自己仔细读题吧。
还有就是无论哪条线它的物品的数值都是连续的,所以我们只要维护每一个位置的左右物品的数值就可以了。
这个规律我一直没有发现,因为我在写题的过程中默认把所有的物品当成一样的了,

2293: Distribution Center 中南多校的更多相关文章

  1. 2292: Quality of Check Digits 中南多校 暴力枚举

    #include <cstdio> #include <algorithm> #include <cstring> #include <iostream> ...

  2. 中南多校对抗赛 第三场 E

    E:Eulerian Flight Tour 题意: 给你一张无向图,要你给这个图加边使得其形成一个欧拉回路 题解: 首先使得所有节点的度都为偶数,然后将这个图联通起来 对于度为奇数的点,将将他和他的 ...

  3. 中南多校对抗赛 第三场 B

    B:Arithmetic Progressions 题意: 给你一个长度为n的序列,问你这个序列中长度最长的等差数列长度为多少 题解: 方法一:将数组从小到大排序,n方扫,枚举出公差d,然后二分找有多 ...

  4. Highest Tower 18中南多校第一场H题

    一.题意 给出N个方块,要求给出一个方案,使得1. 所有方块都被使用到(题目数据保证这点) 2.所有方块垒成一个塔,且上面的方块宽度小于下面的方块 3.每个方块只能用一次,可以横着或者竖着. n范围5 ...

  5. Card Hand Sorting 18中南多校第一场C题

    一.题意 随机给你一堆牌(标准扑克牌),之后让你按照: 第一优先规则:所有相同花色的在一起 第二优先规则:所有相同花色的必须按照升序或者降序排列 问,你最少要拿出多少张牌插入到其他的地方以维持这个状况 ...

  6. Artwork 18年中南多校第一场A

    一.题意 对于一个矩阵,若干道命令,每道命令将会把某一段格子涂黑,请问每次涂黑之后矩阵中未被涂黑的块的数量? 二.思路 保存每道命令,并且忠实的执行他,到最后一步开始搜索联通块的数量,并将其保存. 之 ...

  7. 中南林业大学校赛 I 背包问题 ( 折半枚举 || 01背包递归写法 )

    题目链接 题意 : 中文题 分析 :  价值和重量都太过于大,所以采用折半枚举的方法,详细可以看挑战的超大背包问题 由于 n <= 30 那么可以不必直接记录状态来优化,面对每个用例 直接采用递 ...

  8. Gym - 101158C Distribution Center

    题意:n个传送带,传送带i运送编号为i的物品,机器人可以负责把传送带i上的物品放到传送带i + 1上,也可以把传送带i + 1上的物品放到传送带i上,机器人分布在传送带上x轴的不同位置,问每个传送带最 ...

  9. Difference between the Bill of distribution and sourcing rule.

        https://forums.oracle.com/thread/936768 This is from a users guide  Oracle Supply Chain Planning ...

随机推荐

  1. 12个敏捷过程的小提示Tips

    12个敏捷过程的小提示Tips 1. 可视化一切. 在团队里使用Scrum白板.同时走廊过道上也会挂上显示信息的白板,这些信息可以是公司战略.软件缺陷等等.可视化的好处是,员工经过这些白板时,能够了解 ...

  2. IIS Tomcat共享80端口

    为什么有这种需求, 原因是这样的, 公司有一个Java的web项目,在另一台服务器A上,最近老板一时兴起,想把他合并到这台稳定点的服务器B上,服务器B上使用IIS来寄宿asp.net 网站, 怎么办呢 ...

  3. EF Codefirst 中间表(关系表)的增删改查(转)

    EF Codefirst 多对多关系 操作中间表的 增删改查(CRUD)   前言 此文章只是为了给新手程序员,和经验不多的程序员,在学习ef和lambada表达式的过程中可能遇到的问题. 本次使用订 ...

  4. 【Java每日一题】20170207

    20170206问题解析请点击今日问题下方的“[Java每日一题]20170207”查看(问题解析在公众号首发,公众号ID:weknow619) package Feb2017; public cla ...

  5. idea输入法不跟随解决办法

    最近使用idea开发项目,遇到输入法不跟随的问题,自己动手解决了下 idea输入法不跟随解决办法: 1):系统:windows10 版本:idea2017.2 解决办法:使用QQ输入法 2):系统:w ...

  6. 7;XHTML表单

    1.表单的功能结构 2.文本栏.密码栏.隐藏栏 3.复选栏.单选栏 4.窗体栏位.区块栏位 5.按钮.图像按钮 6.允许上传文件 7.表单的外框和标题 8.元件的次序和快捷键 表单是提供让读者在网页上 ...

  7. Javascript 跨域知识详细介绍

    JS跨域知识总结: 在“跨域”一词经常性地出现以前,我们其实已经频繁地使用它了.如在A网站的img,src指向B网站的某一图片地址,毫无疑问,这在通常情况下都是能正常显示的(且不论防盗链技术):同样, ...

  8. 关于Object数组强转成Integer数组的问题:Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer;

    一.当把Object数组,强转的具体的Integer数组时,会报错. 代码如下: //数组强转报错演示 Object[] numbers = {1,2,3}; Integer[] ints = (In ...

  9. Conccrent中 Unsafe类原理 以及 原子类AutomicXX的原理以及对Unsafe类的使用

    Unsafe类的介绍 Java中基于操作系统级别的原子操作类sun.misc.Unsafe,它是Java中对大多数锁机制实现的最基础类.请注意,JDK 1.8和之前JDK版本的中sun.misc.Un ...

  10. Future FutrueTask Callable类源码说明以及原理使用

    1.Future Callable FutureTask 源码说明 JDK内置的Future主要使用到了Callable接口和FutureTask类. Callable是类似于Runnable的接口, ...