QOJ.ac

QOJ

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

#22739. 헛간 확장

Statistics

John에게 $N$ 직사각형 헛간($1\le N\le25{,}000$), 변은 $X,Y$축 평행, 꼭짓점 정수 좌표는 $0..1,000,000$입니다. 겹치지 않으나 꼭짓점/변 공유는 가능합니다.

올해 젖 짤 소가 늘어 확장합니다. 다른 헛간과 꼭짓점이나 벽을 공유하지 않아야 하며 네 벽을 모두 조금 밖으로 밀어도 부딪히지 않아야 합니다. 꼭짓점에서 닿는 둘은 모두 불가능합니다.

확장 가능한 수를 구하세요.

입력

1행: 정수 $N$.

$2..N+1$행: 공백 구분 $A,B,C,D$, 왼쪽 아래 $(A,B)$, 오른쪽 위 $(C,D)$.

출력

1행: 확장 가능한 헛간 수 정수.

예제

입력 1

5
0 2 2 7
3 5 5 8
4 2 6 4
6 1 8 6
0 0 8 1

출력 1

2

참고

참고

예제 설명:

5헛간; 처음 왼쪽 아래 $(0,2)$, 오른쪽 위 $(2,7)$, 나머지도 같습니다.

입력 처음 두 개만 확장 가능. 나머지는 각각 적어도 하나와 닿습니다.

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.