Codeforces 306B

#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的更多相关文章
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
- CodeForces - 148D Bag of mice
http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...
随机推荐
- 对话 UNIX: 关于 inode
http://www.ibm.com/developerworks/cn/aix/library/au-speakingunix14/ WMI http://wiki.hudson-ci.org/di ...
- 载入OpenSSL的动态库——学会使用tryToLoadOpenSslWin32Library和QPair
Libraries name of openssl? The "library" portion of OpenSSL consists of two libraries. On ...
- QWidget 键盘事件 焦点(源代码级别研究)
在Qt中,键盘事件和QWidget的focus密不可分:一般来说,一个拥有焦点(focus)的QWidget或者grabKeyboard()的QWidget才可以接受键盘事件. 键盘事件派发给谁? 如 ...
- Oracle10g安装中遇到的错误及解决办法
linux解决xhost: unable to open display实用技巧:在Linux下设置xhost方法步骤 第一步:用root登陆linux,启动vnc服务:第二步:根据vnc起来的端口, ...
- JavaEE Tutorials (27) - Java EE的并发工具
27.1并发基础427 27.1.1线程和进程42827.2并发工具的主要组件42827.3并发和事务42927.4并发和安全43027.5jobs并发示例430 27.5.1运行jobs示例4302 ...
- C++类对应的内存结构
提示1:对“内存结构”表示有疑问或不解的,先参考: http://blog.csdn.net/guogangj/archive/2007/05/25/1625199.aspx, 本文使用的表示方法和V ...
- C#中ref和out的使用小结
ref传递的参数是变量的地址,在传入函数后,函数可以使用这些地址处的值,同时函数执行完后,这些变量被带回了调用者.ref传递的参数既可作传入值,也可作返回值. out传递的参数是变量的地址,在传入函数 ...
- poj1050(nyoj104 zoj1074)dp问题
To the Max Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 39913 Accepted: 21099 Desc ...
- ubuntuOS
OpenStack icehource for Ubuntu OS 1,网络规划 2,Ntp apt-get install ntp 3,generate secure passwd apt-get ...
- 使用Flask 生成中文图片验证码
因最近要用到验证码,上网搜了下,发现什么验证码感觉都能被攻破,连最近疯传的变态的12306的验证码居然有人一天就攻破了,所以,综合考虑,还是使用汉字: web框架是Flask,然后使用python的I ...