QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#14734. hlcpq

الإحصائيات

平面上,给出 $n$ 条水平线段和 $n$ 条竖直线段,保证不同线段不在同一直线上。

若两线段有交点则它们连通,若 $a, b$ 连通且 $b, c$ 连通则 $a, c$ 连通。

一条线段 $a$ 是关键的,当且仅当存在另外两条线段 $b, c$,使得 $b, c$ 连通,且删去 $a$ 后 $b, c$ 不连通。

输入格式

第一行一个整数 $n$ 。

接下来 $n$ 行,第 $i$ 行有两个整数 $l, r$($1 \le l < r \le n$),表示一条水平线段 $l \le x \le r$,$y=i$。

接下来 $n$ 行,第 $i$ 行有两个整数 $d, u$($1 \le d < u \le n$),表示一条竖直线段 $x = i$,$d \le y \le u$。

输出格式

输出两行,每行是一个长度为 $n$ 的 $01$ 串。

第一行第 $i$ 位为 $1$ 当且仅当第 $i$ 条水平线段是关键的。

第二行第 $i$ 位为 $1$ 当且仅当第 $i$ 条竖直线段是关键的。

样例数据

样例 1 输入

10
1 4
2 7
1 6
3 7
2 4
1 9
1 3
9 10
3 5
1 7
1 7
1 3
1 3
3 7
1 2
3 5
1 7
5 7
3 9
9 10

样例 1 输出

0100010000
1001000010

子任务

Idea:ccz181078,Solution:ccz181078,Code:ccz181078,Data:ccz181078&nzhtl1477

对于 $100\%$ 的数据,满足 $2 \le n \le 10^5$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.