本题直接对每个区间取并,若出现非法区间就是No 否则就是Yes

#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long LL; LL t[], l[], h[]; void run_case() {
int n;
LL m;
cin >> n >> m;
for(int i = ; i <= n; ++i) cin >> t[i] >> l[i] >> h[i];
LL Left = m, Right = m;
for(int i = ; i <= n; ++i) {
LL times = t[i] - t[i-];
Left = max(l[i], Left-times);
Right = min(h[i], Right+times);
if(Left > Right) {
cout << "NO\n";
return;
}
}
if(Left <= Right) cout << "YES\n";
else cout << "NO\n";
} int main() {
ios::sync_with_stdio(false), cin.tie();
//cout.setf(ios_base::showpoint);cout.precision(10);
int t; cin >> t;
while(t--)
run_case();
cout.flush();
return ;
}

Codeforces 1304C. Air Conditioner的更多相关文章

  1. Codeforces Round #620 (Div. 2) C. Air Conditioner

    Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to ma ...

  2. [CF1304C] Air Conditioner

    维护一区间 \([l,r]\) 人按照时间升序 考虑 \((l_i, h_i, t_i)\),当前的所有区间与这个区间取交 推到 \(t_{i+1}\) 时,所有区间的端点向两边扩张即可 注意把空掉的 ...

  3. Codeforces Round #620 (Div. 2)

    Codeforces Round #620 (Div. 2) A. Two Rabbits 题意 两只兔子相向而跳,一只一次跳距离a,另一只一次跳距离b,每次同时跳,问是否可能到同一位置 题解 每次跳 ...

  4. Codeforces Round #620 (Div. 2) A-F代码 (暂无记录题解)

    A. Two Rabbits (手速题) #include<bits/stdc++.h> using namespace std; typedef long long ll; int ma ...

  5. Codeforces Round #620 (Div. 2) 题解

    A. Two Rabbits 思路: 很明显,如果(y-x)%(a+b)==0的话ans=(y-x)/(a+b),否则就为-1 #include<iostream> #include< ...

  6. 日常维护sql

    修复mysqlcheck -u -p --repair  pmdb prefix="/export/data/mysql/bin/mysql -u -p -e" domain=机房 ...

  7. 又是周六了-MySQL特训

    hi 又是周六,又是磨蹭个一上午~午饭后开始吧 1.MySQL -----子查询与连接(三)----- ----使用INSERT...SELECT插入记录 --数据库内容的英文版本 由于我的WAMP中 ...

  8. Correspondence / ˏkɔris'pɔndәns / dictionary10-800.doc

    I have taken courses in office administration, typing,reports and correspondence writing. Correspond ...

  9. 越狱Season 1-Episode 1: the pilot

    the pilot: 美国电视剧新剧开播都会有一个试播来测试观众对新剧的接受程度,以此来决定是否再继续播下去,也可以说是一个开端,第一集,试播 -Tattoo Artist: That's it. t ...

随机推荐

  1. [踩坑记录] windows10 应用商店打不开 代码: 0x80131500

    在某博客看到的方法,供参考,可以尝试一下,我的也是这么解决的1.打开“运行”输入 inetcpl.cpl (“WINDOWS”+“R”键,输入 inetcpl.cpl亦可)2.点开高级往下拉,勾上&q ...

  2. python-turtle-画雪花-2种方法及效果的详解

    1.方法一: 代码: #python3.8 #xuguojun #2020.1.30 #导出模块 import turtle as t import random as r #定义画雪 def dra ...

  3. 台电X16pro刷机记录

    Android: 如果要刷安卓,需要使用win7系统电脑,且需要安装java环境,同时按住 音量减+电源键进入刷机模式(DNX BOOT MODE..),这时在PhoneFlashTool_5.3.2 ...

  4. Django ORM中的模糊查询

    ORM映射 什么是ORM映射?在笔者认为就是对SQL语句的封装,所写语句与SQL对应语句含义相同,使开发更加简单方便,不过也是存在弊端的,使程序运行效率下降.例如: UserInfo.objects. ...

  5. Git管理代码

    使用Git管理代码 1. 分支管理模式 首先,master分支应该是非常稳定的,开发都在dev分支上,每个人都有自己的分支,时不时地往dev分支上合并就可以了.完成测试后,再把dev分支合并到mast ...

  6. 1、MyBatis框架底层初涉

    1.拜年 哈哈,现在是过年了,祝大家新年好. 本来大过年的是不打算碰电脑的,(抢票除外,三疯同学现在还没抢到票,然后突然又延长假期了).现在疫情严重,被堵家里不能出去了.不能为国家做贡献,但是起码不能 ...

  7. next_permutation的使用-Hdu1027

    Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ( ...

  8. java 责任链模式的三种实现

    责任链模式 责任链模式的定义:使多个对象都有机会处理请求,从而避免请求的发送者和接受者之间的耦合关系, 将这个对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理他为止.这里就不再过多的介绍什么 ...

  9. 九、Appium-python-UI自动化之通过text定位

    1.通过xpath定位text xpath路径为://android.widget.EditText[@text='请输入包含街道的完整地址'] 2.通过AndroidUIAutomator # 这个 ...

  10. 【原】centos安装django

    一.更新系统软件包yum update -y 二.安装软件管理包和可能使用的依赖 yum -y groupinstall "Development tools" yum insta ...