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 ...
随机推荐
- element 确认框 confirm 的写法
this.confirm('内容', '标题', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'success', callbac ...
- Flutter Android 真机器调试 、模拟器调试、Vscode 中开发 Flutter 应用
必备条件: 1.准备一台 Android 手机 2.手机需要开启调试模式 3.用数据线把手机连上电脑 4.手机要允许电脑进行 Usb 调试 5.手机对应的 sdk 版本必须安装 注意: 1.关闭电脑上 ...
- https://www.cnblogs.com/chanshuyi/p/alibaba_review_3_level.html
https://www.cnblogs.com/chanshuyi/p/alibaba_review_3_level.html http://www.cnblogs.com/skywang12345/ ...
- VS2017中遇到不存在从string到const char*的转换函数的解决方法
使用c_str()函数 c_str函数的返回值是const char*. c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. 这是为了与c语言兼容,在c语言中没有stri ...
- ICCV2019 oral:Wavelet Domain Style Transfer for an Effective Perception-distortion Tradeoff in Single Image Super-Resolution
引言 基于低分辨率的图像恢复高分辨图像具有重要意义,近年来,利用深度学习做单张图像超分辨主要有两个大方向:1.减小失真度(distortion, 意味着高PSNR)的图像超分辨,这类方法主要最小化均方 ...
- npm 配置国内淘宝镜像
淘宝NPM镜像官网:http://npm.taobao.org/ npm config set registry=http://registry.npm.taobao.org -g 安装cnpm: n ...
- java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time.....
SpringBoot 2.1.4启动时报错 java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecogniz ...
- pip配置永久国内源
1.windows配置方式: (1)打开文件资源管理器 --------在地址栏中输入 %appdata% (2)手动创建一个文件夹叫做 pip (3)在pip的文件夹里面新建一个文件 pip.ini ...
- 学习笔记(5)- ubuntu对话语料
The Ubuntu Dialogue Corpus: A Large Dataset for Research in Unstructured Multi-Turn Dialogue Systems ...
- WPS/office使用技巧系列
一 WPS中如果要对比2个文档,不想以标签形式打开而是以多窗口形式,该怎么操作? 点击WPS左上角的蓝色或绿色框-->选项->->视图->勾选在任务栏中显示所有窗口,恢复书签模 ...