E. Turn Off The TV Educational Codeforces Round 29
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的更多相关文章
- Educational Codeforces Round 29(6/7)
1.Quasi-palindrome 题意:问一个字符串(你可以添加前导‘0’或不添加)是否是回文串 思路:将给定的字符串的前缀‘0’和后缀‘0’都去掉,然后看其是否为回文串 #include< ...
- Educational Codeforces Round 29
A. Quasi-palindrome 题目链接:http://codeforces.com/contest/863/problem/A 题目意思:问一个数可不可以在不上一些前缀0以后变成一个回文数. ...
- Educational Codeforces Round 41 967 E. Tufurama (CDQ分治 求 二维点数)
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama (CDQ分治 求 二维点数) time limit per test 2 ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [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 ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- Educational Codeforces Round 6 C. Pearls in a Row
Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...
随机推荐
- Redis学习(一):CentOS下redis安装和部署
1.基础知识 redis是用C语言开发的一个开源的高性能键值对(key-value)数据库.它通过提供多种键值数据类型来适应不同场景下的存储需求,目前为止redis支持的键值数据类型如下字符串.列表 ...
- CS小分队第二阶段冲刺站立会议(6月2日)
昨日成果:攻克了按钮移动的问题: 遇到问题:一开始按钮移动时候,非常慢,因为是根绝相对位移差来移动,延时很严重,后来改用用鼠标的位置作为按钮的移动位置,效果明显. 按钮的mousedown事件和mou ...
- 自学iOS-获取当前时间
NSDate * senddate=[NSDate date]; NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init]; [dat ...
- 第一次spring冲刺第7天
讨论成员:王俊凯.王逸辉.罗凯杰.马志磊 讨论问题:进行UI设计的详细讨论,虽然结果各有争议,但最终确定了较为简单的布局页面,并且开始收集精美页面的案例 冲刺尚未结束,同志还需努力,致力于最后.
- DPDK QoS_meter 源码阅读
main.c /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2016 Intel Corporation */ #inclu ...
- ABP ModuleZero 添加角色_创建角色是报错的问题解决方案
ABP升级后,大概3.6.1以后,在.net framework里面,从官方下载的Module zero模板添加角色是出现下面错误. 这个问题,算是新版apb的一点小缺憾,好像在.net core的模 ...
- jenkins构建启动失败
有一个项目,在启动的时候读取了环境变量,第一次写了一个启动脚本如下 #!/bin/bash --login jarFile=$ pid=`ps -ef | grep $jarFile | grep ' ...
- Prism框架的优点
以我粗略的了解,prism/mvvm可以做到完全的逻辑和ui分离.即便是事件都是如此.这是主要优点.mvc是从本质上ui框架(当前大量半吊子把业务逻辑写在里面是不对的),mvvm包含客户端的业务逻辑. ...
- 基于html5的多图片上传,预览
基于html5的多图片上传 本文是建立在张鑫旭大神的多文图片传的基础之上. 首先先放出来大神多图片上传的博客地址:http://www.zhangxinxu.com/wordpress/2011/09 ...
- MicrosoftFixit50688 [Windows7事件ID10,WMI错误的解决方法
Windows7事件记录中有如下错误提示: "Event filter with query "SELECT * FROM __InstanceModificationEve ...