A13071 | New Year and Conference
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Filled with optimism, Hyunuk will host a conference about how great this new year will be!
The conference will have $n$ lectures. Hyunuk has two candidate venues $a$ and $b$ . For each of the $n$ lectures, the speaker specified two time intervals $[sa_i, ea_i]$ ( $sa_i \le ea_i$ ) and $[sb_i, eb_i]$ ( $sb_i \le eb_i$ ). If the conference is situated in venue $a$ , the lecture will be held from $sa_i$ to $ea_i$ , and if the conference is situated in venue $b$ , the lecture will be held from $sb_i$ to $eb_i$ . Hyunuk will choose one of these venues and all lectures will be held at that venue.
Two lectures are said to overlap if they share any point in time in common. Formally, a lecture held in interval $[x, y]$ overlaps with a lecture held in interval $[u, v]$ if and only if $\max(x, u) \le \min(y, v)$ .
We say that a participant can attend a subset $s$ of the lectures if the lectures in $s$ do not pairwise overlap (i.e. no two lectures overlap). Note that the possibility of attending may depend on whether Hyunuk selected venue $a$ or venue $b$ to hold the conference.
A subset of lectures $s$ is said to be venue-sensitive if, for one of the venues, the participant can attend $s$ , but for the other venue, the participant cannot attend $s$ .
A venue-sensitive set is problematic for a participant who is interested in attending the lectures in $s$ because the participant cannot be sure whether the lecture times will overlap. Hyunuk will be happy if and only if there are no venue-sensitive sets. Determine whether Hyunuk will be happy.
The conference will have $n$ lectures. Hyunuk has two candidate venues $a$ and $b$ . For each of the $n$ lectures, the speaker specified two time intervals $[sa_i, ea_i]$ ( $sa_i \le ea_i$ ) and $[sb_i, eb_i]$ ( $sb_i \le eb_i$ ). If the conference is situated in venue $a$ , the lecture will be held from $sa_i$ to $ea_i$ , and if the conference is situated in venue $b$ , the lecture will be held from $sb_i$ to $eb_i$ . Hyunuk will choose one of these venues and all lectures will be held at that venue.
Two lectures are said to overlap if they share any point in time in common. Formally, a lecture held in interval $[x, y]$ overlaps with a lecture held in interval $[u, v]$ if and only if $\max(x, u) \le \min(y, v)$ .
We say that a participant can attend a subset $s$ of the lectures if the lectures in $s$ do not pairwise overlap (i.e. no two lectures overlap). Note that the possibility of attending may depend on whether Hyunuk selected venue $a$ or venue $b$ to hold the conference.
A subset of lectures $s$ is said to be venue-sensitive if, for one of the venues, the participant can attend $s$ , but for the other venue, the participant cannot attend $s$ .
A venue-sensitive set is problematic for a participant who is interested in attending the lectures in $s$ because the participant cannot be sure whether the lecture times will overlap. Hyunuk will be happy if and only if there are no venue-sensitive sets. Determine whether Hyunuk will be happy.
输入格式
The first line contains an integer $n$ ( $1 \le n \le 100\,000$ ), the number of lectures held in the conference.
Each of the next $n$ lines contains four integers $sa_i$ , $ea_i$ , $sb_i$ , $eb_i$ ( $1 \le sa_i, ea_i, sb_i, eb_i \le 10^9$ , $sa_i \le ea_i, sb_i \le eb_i$ ).
Each of the next $n$ lines contains four integers $sa_i$ , $ea_i$ , $sb_i$ , $eb_i$ ( $1 \le sa_i, ea_i, sb_i, eb_i \le 10^9$ , $sa_i \le ea_i, sb_i \le eb_i$ ).
输出格式
Print "YES" if Hyunuk will be happy. Print "NO" otherwise.
You can print each letter in any case (upper or lower).
You can print each letter in any case (upper or lower).
输入输出样例
输入 #1
2 1 2 3 6 3 4 7 8
输出 #1
YES
输入 #2
3 1 3 2 4 4 5 6 7 3 4 5 5
输出 #2
NO
输入 #3
6 1 5 2 9 2 4 5 8 3 6 7 11 7 10 12 16 8 11 13 17 9 12 14 18
输出 #3
YES
In second example, lecture set $\{1, 3\}$ is venue-sensitive. Because participant can't attend this lectures in venue $a$ , but can attend in venue $b$ .
In first and third example, venue-sensitive set does not exist.
In first and third example, venue-sensitive set does not exist.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted