Codeforces 1304C. Air Conditioner
本题直接对每个区间取并,若出现非法区间就是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的更多相关文章
- 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 ...
- [CF1304C] Air Conditioner
维护一区间 \([l,r]\) 人按照时间升序 考虑 \((l_i, h_i, t_i)\),当前的所有区间与这个区间取交 推到 \(t_{i+1}\) 时,所有区间的端点向两边扩张即可 注意把空掉的 ...
- Codeforces Round #620 (Div. 2)
Codeforces Round #620 (Div. 2) A. Two Rabbits 题意 两只兔子相向而跳,一只一次跳距离a,另一只一次跳距离b,每次同时跳,问是否可能到同一位置 题解 每次跳 ...
- Codeforces Round #620 (Div. 2) A-F代码 (暂无记录题解)
A. Two Rabbits (手速题) #include<bits/stdc++.h> using namespace std; typedef long long ll; int ma ...
- Codeforces Round #620 (Div. 2) 题解
A. Two Rabbits 思路: 很明显,如果(y-x)%(a+b)==0的话ans=(y-x)/(a+b),否则就为-1 #include<iostream> #include< ...
- 日常维护sql
修复mysqlcheck -u -p --repair pmdb prefix="/export/data/mysql/bin/mysql -u -p -e" domain=机房 ...
- 又是周六了-MySQL特训
hi 又是周六,又是磨蹭个一上午~午饭后开始吧 1.MySQL -----子查询与连接(三)----- ----使用INSERT...SELECT插入记录 --数据库内容的英文版本 由于我的WAMP中 ...
- Correspondence / ˏkɔris'pɔndәns / dictionary10-800.doc
I have taken courses in office administration, typing,reports and correspondence writing. Correspond ...
- 越狱Season 1-Episode 1: the pilot
the pilot: 美国电视剧新剧开播都会有一个试播来测试观众对新剧的接受程度,以此来决定是否再继续播下去,也可以说是一个开端,第一集,试播 -Tattoo Artist: That's it. t ...
随机推荐
- cookie的封装
今天逛论坛,看到一个看起来写得好的函数,特此贴出分享: 原文地址[http://www.html-js.com/article/2638 ] 这个地址[https://github.com/jaywc ...
- 连接(JOIN)
join 用于把来自两个或多个表的行结合起来,基于这些表之间的共同字段. INNER JOIN 从多个表中返回满足 JOIN 条件的所有行. INNER JOIN:如果表中有至少一个匹配,则返回行 L ...
- 【PAT甲级】1094 The Largest Generation (25 分)(DFS)
题意: 输入两个正整数N和M(N<100,M<N),表示结点数量和有孩子结点的结点数量,输出拥有结点最多的层的结点数量和层号(根节点为01,层数为1,层号向下递增). AAAAAccept ...
- ES数据同步方案
当业务量上升后,由于mysql对全文检索或模糊查询支持的能力不强,在系统中查询的地方,往往会出现慢sql等,拖累系统其他模块,造成性能低下. 随着ES使用普及率的升高,ES是mysql的一个有效补充. ...
- VS2019 还原Resharper菜单位置
方法: 第一步: Tools -> Customize -> Extensions Menu tab, uncheck Resharper 工具->自定义->扩展菜单-> ...
- windows 下安装chrome 调试iphone插件 ios-webkit-debug-proxy
必备: 1. .NET Framework 4.5 及以上版本 2.powershell 5.1及以上版本 3.可正常访问 https://raw.githubusercontent.com/luk ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 从已有的数组创建数组
import numpy as np x = [1,2,3] a = np.asarray(x) print (a) import numpy as np x = (1,2,3) a = np.asa ...
- BGP前缀过滤(正则表达式)
BGP的正则表达式一般用在as-path中,常用的如下: .(点):表示匹配任意一个字符,包括空格. *:表示匹配零个或多个模式的出现.即前一个字符出现0次或多次. +:表示匹配一个或多个模式的出现. ...
- Linux kali安装或更新之后出现乱码
打开终端,输入以下命令,之后重启. apt-get install ttf-wqy-zenhei
- DHCP与DHCP中继原理与配置!(重点)
一 .DHCP 服务概述 0:dhcp原理: 集中的管理.分配IP地址,使client动态的获得IP地址.Gateway地址.DNS服务器地址等信息,并能够提升地址的使用率.简单来说,DHCP就是一 ...