本题直接对每个区间取并,若出现非法区间就是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. javascript中offsetWidth、clientWidth、width、scrollWidth、clientX、screenX、offsetX、pageX

    原文:https://www.cnblogs.com/ifworld/p/7605954.html 元素宽高 offsetWidth //返回元素的宽度(包括元素宽度.内边距和边框,不包括外边距) o ...

  2. 循环select和取赋值

    bootstrap: <!--列表容器--> <div class="panel-body" style="position:relative;&quo ...

  3. 吴裕雄 python 机器学习——数据预处理字典学习模型

    from sklearn.decomposition import DictionaryLearning #数据预处理字典学习DictionaryLearning模型 def test_Diction ...

  4. SpringBoot-自动装载

    1,SpringBoot里面有内置的tomcat容器. 2,SpringBoot是基于已有的东西创建的新的东西.核心:(AutoConfiguration)自动装载,Starter,Actuator, ...

  5. netty(七)buffer源码学习2

    概述 文章主要介绍的是PoolArena,PoolChunk,PoolSubpage 三个类的源码 PoolArena PoolArena 是netty 的内存池实现类,通过预先申请一块大的空间,然后 ...

  6. dp(小猪存钱罐)

                      B - Piggy-Bank 在acm能够做任何事情之前, 必须编制预算并获得必要的财政支持.这一行动的主要收入来自IBM.这个想法其实很简单,每当一些会员有一点小 ...

  7. socketserver tcp黏包

    socket (套接字) tcp(黏包现象原因) 传输中由于内核区缓冲机制(等待时间,文件大小),会在 发送端 缓冲区合并连续send的数据,也会出现在 接收端 缓冲区合并recv的数据给指定port ...

  8. 传奇定时器OnTimer功能详解(泡点、时间触发、任务活动)

    传奇定时器OnTimer功能详解(泡点.时间触发.任务活动) 定时器功能,是传奇服务端中非常常见的一种功能,常见如:泡点脚本.赌博脚本,任务活动指定时间刷怪,时间触发一些都需要用到OnTimer功能, ...

  9. window照片查看器无法查看照片的问题

    查看其他照片都可以,只有特殊的两张无法查看.百度|| 修改了环境变量中的tmp变量,路径改为e:\tmp(注:要选择磁盘空间足够的磁盘). 刷新过后,重新打开同一张图片,如下: 用系统自带画图软件尝试 ...

  10. Python数据分析之Numpy操作大全

    从头到尾都是手码的,文中的所有示例也都是在Pycharm中运行过的,自己整理笔记的最大好处在于可以按照自己的思路来构建矿建,等到将来在需要的时候能够以最快的速度看懂并应用=_= 注:为方便表述,本章设 ...