不醒人室

1004 不醒人室 (hdu.edu.cn)

#include<bits/stdc++.h>

#define int long long

using namespace std;

const int N = 2e5+10;

int n, m;

struct node{

int l, r, s;

}stN;

bool cmp(node x, node y){

return x.l < y.l;

}

void solve(){

int cnt = 0;

cin >> n >> m;

for(int i = 0; i < n; i ++){

int x, y;

cin >> x >> y;

stcnt ++ = {x, y, 1};

}

for(int i = 0; i < m; i ++){

int x, y;

cin >> x >> y;

stcnt ++ = {x, y, 0};

}

sort(st, st+cnt, cmp);

for(int i = 1; i < cnt; i ++){

if(sti.l < sti-1.r){

cout << "No\n";

return ;

}

}

int x = 0;

for(int i = 0; i < cnt; i ++){

if(sti.s)

{

if(x < sti.r)

{

cout << "No\n";

return ;

}

}

else

{

x = sti.r+2*(sti.r-sti.l);

}

}

cout << "Yes\n";

}

signed main(){

ios::sync_with_stdio(0);

cin.tie(0), cout.tie(0);

int T = 1;

cin >> T;

while(T --){

solve();

}

return 0;

}

相关推荐
小许同学记录成长17 分钟前
相对辐射定标技术文档
图像处理·算法
白白白小纯41 分钟前
算法篇—返回倒数第k个节点
c语言·数据结构·算法·leetcode
小羊先生car1 小时前
RTOS-F429-HAL-(动/静态)任务的创建(2026/7/27)
开发语言·算法·c#
无忧.芙桃1 小时前
数据结构之堆
c语言·数据结构·c++·算法·
小蒋学算法1 小时前
算法-删除元素后最大固定点数目-典型最长增长序列算法
数据结构·算法
RD_daoyi1 小时前
Google偷偷给AI引用加了五个新功能:内联引用、悬停预览、品牌展示……但点击率真的回来了吗?
大数据·网络·人工智能·算法·安全·搜索引擎
船漏了就会沉1 小时前
后缀自动机(SAM):字符串处理的“万能瑞士军刀”
算法
白白白小纯3 小时前
算法篇—链表的中间节点
c语言·数据结构·算法·leetcode
Frostnova丶3 小时前
(19)LeetCode 54. 螺旋矩阵
算法·leetcode·矩阵
Frostnova丶3 小时前
(18)LeetCode 73. 矩阵置零
算法·leetcode·矩阵