当前位置:网站首页>Cf1304c air conditioner
Cf1304c air conditioner
2022-06-10 09:33:00 【eva_ can(not)survive】
Air Conditioner - Luogu
https://www.luogu.com.cn/problem/CF1304C
Given initial temperature , Consider maintaining a section of indoor air conditioning, i.e [l-t,r+t] Then modify the temperature range according to the temperature range that the guests adapt to at each time , If it can no longer adapt to the guest's interval, it is NO, Otherwise YES.
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <unordered_map>
#include <cmath>
#include <map>
#include <cctype>
#include <cstdlib>
#include <deque>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int MN = 65005;
const int MAXN = 1e6 + 5;
const int INF = 0x3f3f3f3f;
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) ((x)&(-x))
struct node {
int t, l, r;
};
node s[MAXN];
inline void solve() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d %d %d", &s[i].t, &s[i].l, &s[i].r);
}
bool flag = true;
int l = m, r = m;
for (int i = 1; i <= n; i++) {
int d = s[i].t - s[i - 1].t;
l = max(l - d, s[i].l);
r = min(r + d, s[i].r);
if (l > r) {
flag = false;
break;
}
}
if (flag)
printf("YES\n");
else
printf("NO\n");
}
int main() {
int t;
scanf("%d", &t);
while (t--)
solve();
return 0;
}
边栏推荐
- 小bai月赛49 E 禅(DP)
- 10 revelations from the success of digital transformation
- Win11 installing pandoc
- C语言define变参__VA_ARGS__及##__VA_ARGS__的使用
- pip install . And pip install -e Differences between
- How to Understand Your Data With Visualization
- Principal Component Analysis
- How to Understand Your Data With Descriptive Statistics
- Error reporting and solution of request calling get method
- Message queue selection manual
猜你喜欢

solr高級查詢應用---按字段分組查詢

Talking about the methods of digital transformation | correctly understanding digital transformation

Deploy MySQL based on statefulset in kubernetes (Part 1)

Brush force buckle from 0

谈谈数字化转型方法|正确认识数字化转型

Linear Regression

How to Spot-Check Classification Algorithms

Switch the formatting plug-in of vscode

想做钢铁侠?听说很多大佬都是用它入门的

关于函数声明的思考
随机推荐
C language define variable parameter__ VA_ ARGS__ And__ VA_ ARGS__ Use of
Compiler-pl/0 language compiler function extension
A camera communication protocol verification CRC program
阿里巴巴数字化转型的启示
js獲取當前時間
Pandas writes to MySQL database
BlockingQueue, synchronousqueue, arrayblockingqueue, reentrantlock, semaphore, fair and unfair
Is it safe to open a stock account by mobile phone?
Thinking about function declaration
Error reporting and solution of request calling get method
对C语言指针强转的理解
悬赏任务源码开发设计构建时,要留意哪些事项
谈谈2022年数字化转型的趋势
Pointnet: deep learning on point sets for 3D classi "location and segmentation
Share the 2022 China supply chain digital upgrading industry research report (PDF attached)
Printk learning part 3: are you still using printk?
谈谈数字化转型方法|正确认识数字化转型
并发-创建线程
GNSS positioning data collection
mmclassification