本题直接对每个区间取并,若出现非法区间就是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 ;
}

最新文章

  1. SVN Client
  2. UEFI安装Kali Linux 1.1.0记录
  3. 获取shell脚本自身所在目录的Shell脚本分享
  4. ahjesus根据身份证号码获取相关信息(生日,省市县,性别)
  5. postgresql 锁的定位
  6. J2EE事务
  7. mapper配置
  8. JSP学习笔记2
  9. iOS 后台运行实现 --备用
  10. 离线安装maven
  11. VB.NET版机房收费系统---SqlHelper
  12. git修改最后一次commit的内容
  13. java基础语法(标识符 修饰符 关键字)
  14. 使用 Mutex 实现进程间同步
  15. 接口测试-webservice接口---soapui
  16. sourceTree跳过注册
  17. 循序渐进学.Net Core Web Api开发系列【0】:序言与目录
  18. xcode调试查看变量的值
  19. jmeter测试计划配置
  20. Sqlserver数据库还原.bak文件失败的两个问题

热门文章

  1. linux下删除文件夹
  2. aria2连接网站出现handshake failure问题的分析与解决方法
  3. 【PAT甲级】1092 To Buy or Not to Buy (20 分)
  4. disconf---分布式配置管理平台的搭建(windows版本)
  5. Django 字段中 null 和 blank的区别
  6. Git基础及进阶-系统总结
  7. 2.3.FastDFS-单机拆分版-与Nginx整合配置
  8. Elasticsearch系列---初识mapping
  9. 使用UUID防止文件重名
  10. 电力电子实验 LLC半桥谐振变换器 记录