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

注意细节

 1 #include <cstdio>
 2 #include <cstdlib>
 3 #include <cmath>
 4 #include <cstring>
 5 #include <time.h>
 6 #include <string>
 7 #include <set>
 8 #include <map>
 9 #include <list>
10 #include <stack>
11 #include <queue>
12 #include <vector>
13 #include <bitset>
14 #include <ext/rope>
15 #include <algorithm>
16 #include <iostream>
17 using namespace std;
18 #define ll long long
19 #define minv 1e-6
20 #define inf 1e9
21 #define pi 3.1415926536
22 #define E  2.7182818284
23 const ll mod=1e9+7;//998244353
24 const int maxn=2e5+10;
25
26 struct node
27 {
28     int x,y,z;
29 }f[maxn];
30
31 bool vis[maxn]={0};
32
33 int cmp(node a,node b)
34 {
35     if (a.x==b.x)
36         return a.y>b.y;
37     else
38         return a.x<b.x;
39 }
40
41 int main()
42 {
43     int n,i,j,yy;
44     scanf("%d",&n);
45     for (i=1;i<=n;i++)
46         scanf("%d%d",&f[i].x,&f[i].y),f[i].z=i;
47     sort(f+1,f+n+1,cmp);
48     vis[f[1].z]=1;
49     j=1;
50     for (i=1;i<=n;)
51     {
52         yy=f[j].y+1;
53         i++;
54         j=i;
55         while (i<=n && f[i].x<=yy)
56         {
57             if (f[i].y>f[j].y)
58                 j=i;
59             i++;
60         }
61         if (f[j].y<=yy-1)
62             j=i;
63         else
64             i--;
65         vis[f[j].z]=1;
66     }
67     for (i=1;i<=n;i++)
68         if (!vis[i])
69         {
70             printf("%d",i);
71             return 0;
72         }
73     printf("-1");
74     return 0;
75 }
76 /*
77 3
78
79 3687 7959
80
81 4918 9822
82
83 8049 11728
84 */

转载于:https://www.cnblogs.com/cmyg/p/9521050.html

E. Turn Off The TV Educational Codeforces Round 29相关推荐

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

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

  2. Educational Codeforces Round 114 (Rated for Div. 2) (A ~ F)全题解

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Educational Codeforces Round 114 (Rated for Div. 2) ...

  3. Educational Codeforces Round 106 (Rated for Div. 2)(A ~ E)题解(每日训练 Day.16 )

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 Educational Codeforces Round 106 (Rated for Div. ...

  4. Educational Codeforces Round 32

    http://codeforces.com/contest/888 A Local Extrema[水] [题意]:计算极值点个数 [分析]:除了第一个最后一个外,遇到极值点ans++,包括极大和极小 ...

  5. Educational Codeforces Round 37 (Rated for Div. 2) 1

    Educational Codeforces Round 37 (Rated for Div. 2) A.Water The Garden 题意:Max想给花园浇水.花园可被视为长度为n的花园床,花园 ...

  6. Educational Codeforces Round 90 (Rated for Div. 2)(A, B, C, D, E)

    Educational Codeforces Round 90 (Rated for Div. 2) Donut Shops 思路 分三种情况: a==c/ba == c / ba==c/b这个时候两 ...

  7. Educational Codeforces Round 89 (Rated for Div. 2)(A, B, C, D)

    Educational Codeforces Round 89 (Rated for Div. 2) A. Shovels and Swords 思路 题意非常简单,就是得到最多的物品嘛,我们假定a, ...

  8. Educational Codeforces Round 114 (Rated for Div. 2) D. The Strongest Build 暴力 + bfs

    传送门 文章目录 题意: 思路: 题意: 你有nnn个装备槽,每个槽里面有cic_ici​个力量加成,对于每个槽只能选一个力量加成,现在给你mmm个力量组合[b1,b2,...,bn][b_1,b_2 ...

  9. Educational Codeforces Round 17 E. Radio stations cdq分治 + 树状数组

    传送门 文章目录 题意 思路: 题意 有nnn个电台,对于每个电台iii有三个参数xi,ri,fix_i,r_i,f_ixi​,ri​,fi​,分别指他们的坐标.作用半径.频率.如果两个电台频率差值在 ...

最新文章

  1. 在哪里能收到python实例代码-python实现网站微信登录的示例代码
  2. SharePoint At Work----Hyperlinks in the Data View Web Part
  3. mysql text保存图片_用mysql 如果包含有文字和图片,那么我要用哪种数据类型存储呢?还是分开,用TEXT和BLOB吗?...
  4. 前端框架:AntdUI 文档入门
  5. AAAI 2020 | 腾讯优图10篇论文入选,含速算识别、视频识别等主题
  6. 论文解读丨Zero-Shot场景下的信息结构化提取
  7. html上传图片(进度条变化)、音乐
  8. 大哥吾博文写得清清楚楚,怎么就不试一下?
  9. 378.有序矩阵中第k小的元素(力扣leetcode) 博主可答疑该问题
  10. 国内首款性能最稳定ISO 14443B身份证读卡器芯片FSV9523国产替代MFRC523 国产NFC芯片 不缺货 性价比高 可提供软硬件DEMO
  11. Leetcode 1653. Minimum Deletions to Make String Balanced [Python]
  12. 图片太大导致 imageView无法显示
  13. 人证核验、人证比对系统应用行业如何判别
  14. 弹幕穿人过,视频换背景,快准狠的图像分割技术了解一下
  15. APP 专项测试之兼容性测试
  16. 万用表的使用方法,焊接
  17. win10 wifi连接不上服务器未响应,简单几步解决win10wifi一直断开连接不上的问题...
  18. XAMPP/PHPnow/phpStudy安装使用对比
  19. 小彩灯特效 html+css
  20. arduino 警灯DIY教程

热门文章

  1. starUML--面向对象的设计过程
  2. 汇编语言出现的历史背景
  3. UNIX再学习 -- 高级 I/O
  4. 【译】Introduction to Smart Contract and DApp Security
  5. PoW 本质上是个去中心化的时钟
  6. android使用HttpURLConnection/HttpClient实现带参数文件上传
  7. BZOJ 3673: 可持久化并查集 by zky
  8. flex 文字竖排_flex button字竖排展示
  9. debugger vsm_ProteusVSM常见问题解答
  10. python 字符串 f_Python字符串格式化f-string多种功能实现