QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB 總分: 100

#14843. 砌砖

统计

我们尝试将一面墙设计为二维矩形砖块的镶嵌,所有砖块都具有精确的整数坐标和精确的整数尺寸。

给定该二维墙壁中砖块布局的描述,判断这面墙是否确实是一面“墙”——即恰好覆盖一个完美的矩形,砖块之间既没有重叠,也没有空隙。这意味着该区域内部的每个非整数坐标都应当被恰好一块砖覆盖。

图 B.1:分别对应样例 1、2 和 3 的砖墙示意图。

输入格式

  • 第一行包含一个整数 $n$($1 \le n \le 1,000,000$),表示砖块的数量。
  • 接下来的 $n$ 行,每行包含四个整数 $x$ $y$ $w$ $h$,描述一块砖的信息,分别表示其 $xy$ 坐标、宽度和高度($0 \le x, y \le 10^8$;$1 \le w, h \le 10^8$)。

输出格式

如果这些砖块构成了一面合法的墙,输出 yes,否则输出 no

样例

输入样例 1

5
0 0 5 1
1 1 4 4
0 1 1 5
1 5 5 1
5 0 1 5

输出样例 1

yes

输入样例 2

3
1 0 3 3
0 1 3 3
3 3 1 1

输出样例 2

no

输入样例 3

4
1 1 2 1
0 0 2 1
0 1 1 1
2 0 1 1

输出样例 3

yes

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.