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

注意细节

 #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <time.h>
#include <string>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <ext/rope>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long
#define minv 1e-6
#define inf 1e9
#define pi 3.1415926536
#define E 2.7182818284
const ll mod=1e9+;//
const int maxn=2e5+; struct node
{
int x,y,z;
}f[maxn]; bool vis[maxn]={}; int cmp(node a,node b)
{
if (a.x==b.x)
return a.y>b.y;
else
return a.x<b.x;
} int main()
{
int n,i,j,yy;
scanf("%d",&n);
for (i=;i<=n;i++)
scanf("%d%d",&f[i].x,&f[i].y),f[i].z=i;
sort(f+,f+n+,cmp);
vis[f[].z]=;
j=;
for (i=;i<=n;)
{
yy=f[j].y+;
i++;
j=i;
while (i<=n && f[i].x<=yy)
{
if (f[i].y>f[j].y)
j=i;
i++;
}
if (f[j].y<=yy-)
j=i;
else
i--;
vis[f[j].z]=;
}
for (i=;i<=n;i++)
if (!vis[i])
{
printf("%d",i);
return ;
}
printf("-1");
return ;
}
/*
3 3687 7959 4918 9822 8049 11728
*/

E. Turn Off The TV Educational Codeforces Round 29的更多相关文章

  1. Educational Codeforces Round 29(6/7)

    1.Quasi-palindrome 题意:问一个字符串(你可以添加前导‘0’或不添加)是否是回文串 思路:将给定的字符串的前缀‘0’和后缀‘0’都去掉,然后看其是否为回文串 #include< ...

  2. Educational Codeforces Round 29

    A. Quasi-palindrome 题目链接:http://codeforces.com/contest/863/problem/A 题目意思:问一个数可不可以在不上一些前缀0以后变成一个回文数. ...

  3. Educational Codeforces Round 41 967 E. Tufurama (CDQ分治 求 二维点数)

    Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama (CDQ分治 求 二维点数) time limit per test 2 ...

  4. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  5. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  6. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  7. [Educational Codeforces Round 16]B. Optimal Point on a Line

    [Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...

  8. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  9. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

随机推荐

  1. Workbook对象的方法总结(一)

    import openpyxlwb=openpyxl.Workbook()print('1.添加前所有工作簿的名称是:',wb.get_sheet_names())wb.create_sheet('F ...

  2. c++ 整数和字符串的转化

    一.string转int的方式 采用最原始的string, 然后按照十进制的特点进行算术运算得到int,但是这种方式太麻烦,这里不介绍了. 采用标准库中atoi函数. "; int a = ...

  3. 工程能力之C4模型

    概述 刚在InfoQ上看到一篇介绍C4Model的文章,觉得这个模型设计的很赞,很有指导意义,做个简单的记录. Why,为什么需要架构图? ThoughtWorks中国 文章中有几句话我觉得很有道理, ...

  4. java后端面试题汇总

    转载链接:https://www.nowcoder.com/discuss/90776?type=0&order=0&pos=23&page=0 基础篇 数据结构与算法 线性表 ...

  5. 查看linux端口对应的进程id

    例如:查看占用4040端口的进程 ss -lptn 'sport = :4040'

  6. Python3中的函数 大全

    Python 函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.Python提供了许多内建函数,比如print().但也可以自己创建 ...

  7. Class-dump 安装和使用记录(导出应用的头文件)

    class-dump算是逆向工程中一个入门级的工具,可以很方便的导出程序头文件,可以轻松的了解程序结构方便逆向.安装包下载地址:http://stevenygard.com/projects/clas ...

  8. css3 transform属性多值的顺序问题

    对于transform属性的多值的顺序问题,我自己就被困扰过.后来知道了跟顺序有关,但是不知道为什么.我想应该很多人跟我以前一样,知其然不知其所以然.如果不知道的,也许这篇文章会对大家有所帮助. 先来 ...

  9. jdbc连接获取表名称

    1,Class.forName可以替换为mysql之类其他的数据库驱动 public Connection connect(String url,String username,String pw, ...

  10. Daily Scrum1 11.3

    今天是我们团队进入代码实现阶段的第一天,经过一周对上一届项目代码的阅读和研究,队员们已经从代码中分析出我们这次项目将要修改和补充的地方,我们接下来要做的地方就是在两周的时间内将团队项目在alpha阶段 ...