#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <set>
#include <map>
using namespace std; const int maxm=int(2e5)+; struct data
{
int x, y, num;
bool operator < (const data b) const
{
if (x!=b.x) return x<b.x;
return y>b.y;
}
}; int n, m;
int ans;
data a[maxm];
bool vis[maxm]; void init()
{
scanf("%d%d", &n, &m);
for (int i=; i<=m; ++i)
{
scanf("%d%d", &a[i].x, &a[i].y);
a[i].y+=a[i].x-;
a[i].num=i;
}
sort(a+, a++m);
}
void solve()
{
ans=m;
for (int i=, next; i<=m; i=next)
{
vis[a[i].num]=true;
ans--;
next=i;
int k=i+;
while (k<=m && a[k].x<=a[i].y+)
{
if (a[k].y>a[next].y) next=k;
++k;
}
if (next==i) next=k;
}
printf("%d\n", ans);
for (int i=; i<=m; ++i)
if (!vis[i]) printf("%d ", i);
}
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
init();
solve();
return ;
}

Codeforces 306B的更多相关文章

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

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

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

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

  3. 【Codeforces 738C】Road to Cinema

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

  4. 【Codeforces 738A】Interview with Oleg

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

  5. CodeForces - 662A Gambling Nim

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

  6. CodeForces - 274B Zero Tree

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

  7. CodeForces - 261B Maxim and Restaurant

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

  8. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

  9. CodeForces - 148D Bag of mice

    http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...

随机推荐

  1. jQuery图片懒加载lazyload插件

    http://www.neoease.com/lazy-load-jquery-plugin-delay-load-image/ js 模板引擎

  2. supervisor python开发的进程管理工具

    Supervisor (http://supervisord.org) 是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(不仅仅是 Python 进程).除了对单个进程的 ...

  3. SQL Server 连接和事务相关的问题。

    方法 1. dbcc opentran + sys.dm_exec_connections dbcc opentran; dbcc opentran 针对当前数据库 dbcc opentran('St ...

  4. VMware虚拟机三种网络模式的区别(上篇)

    提到VMware大家就想起了虚拟机技术,虚拟机技术在最近的几年中得到了广泛的发展,一些大型网络服务商都开始采用虚拟机技术,不仅节省了投资成本,更节约了能源的消耗. 我们知道VMware也分几种版本,普 ...

  5. hdu 5093 Battle ships 匈牙利 很巧妙的建图思路

    //这题逼我把匈牙利学了 之前一直很勤快敲网络流 而且不以为耻反以为荣 解:首先按行扫描编号,如果在同一块中(即可以相互攻击),那么将其标为相同的数组,对列也做同样的操作. 然后扫描整张图,如果行编号 ...

  6. 【FSFA 读书笔记】Ch 2 Computer Foundatinons(2)

    Hard Disk Technology 1. 机械硬盘内部构造 几个重要概念:Sector(扇区),Head(读写头),Track(磁道),Cylinder(柱面). 如果一个文件比较大,磁盘的写入 ...

  7. hdu 5607 graph (矩阵乘法快速幂)

    考虑一个经典的问题: 询问从某个点出发,走 k 步到达其它各点的方案数? 这个问题可以转化为矩阵相乘,所以矩阵快速幂即可解决. 本题思路: 矩阵经典问题:求从i点走k步后到达j点的方案数(mod p) ...

  8. js添加、删除Cookie

    //cookie function addCookie(objName, objValue, objHours) { //添加cookie var str = objName + "=&qu ...

  9. Iterator(迭代器模式)--(超市管理者)

    这个Iterator就是收银台干的活. package patterns.actions.iterator; public interface IteratorList { boolean isEmp ...

  10. PropertyGrid--为复杂属性提供编辑功能

    零.引言 PropertyGrid用来显示某一对象的属性,但是并不是所有的属性都能编辑,基本数据类型(int, double等)和.Net一些封装的类型(Size,Color等)可以编辑,但是对于自己 ...