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只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...
随机推荐
- ctype.h库函数
头文件ctype.h声明了一组用于分类和转换单个字符的函数.所有的函数都接收一个int型的参数,并返回一个int——返回的int可能代表一个字符,也可能代表的是bool值(0为假,非0为真). 你可能 ...
- HD1083 二分图,匈牙利算法
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<stdio.h> #include<stdlib. ...
- nginx请求体读取(二)
2,丢弃请求体 一个模块想要主动的丢弃客户端发过的请求体,可以调用nginx核心提供的ngx_http_discard_request_body()接口,主动丢弃的原因可能有很多种,如模块的业务逻辑压 ...
- 获取ActiveX控件本身所在的路径 和 error PRJ0050
一. CString GetCurPath() { TCHAR exeFullPath[MAX_PATH]; CString strPath; ...
- 我(webabcd)的文章索引
[最后更新:2014.08.28] 重新想象 Windows Store Apps 系列文章 重新想象 Windows 8 Store Apps 系列文章 重新想象 Windows 8 Store A ...
- OSCHina技术导向:开源企业ERP系统Opentaps
opentaps Open Source ERP + CRM 基于 Apache OFBiz (The Open For Business Project ) 构建, 是一款设计良好, 逐渐流行起来的 ...
- 【POJ】3468 A Simple Problem with Integers ——线段树 成段更新 懒惰标记
A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072K Case Time Limit:2000MS Descr ...
- phpadmin
一晚上都在调试数据库,都要疯了,整理如下: 0.Apache服务器的443端口与VMware的冲突,所以要更改配置文件.设为440就可以(这个随意). 1.因为要远程访问,默认密码为空,所以首先给ro ...
- poj1220 (高精度任意进制转换)
http://poj.org/problem?id=1220 高精度任意进制转换 代码是从discuss里找到的,据说是maigo神牛写的. 超精简!! 我自己第一写的时候,还把n进制先转成10进制, ...
- oracle resetlog与noresetlog的作用(转载)
关于resetlog的作用是将日志序列重置,这样以前的归档就作废. 首先一定要明白oracle工作的基本原理,归档情况下:大家一定要同步,谁也不能滞后或者超前,也就是SCN号,如果学oracle不懂s ...