포럼
문제 COCI00432

Unija

설명

1 \(s / 64\) \(MB / 100\) points

데카르트 좌표계의 중심에 중심이 놓여 있고 변이 좌표축에 평행한 직사각형 \(N\)개가 주어진다. 각 직사각형은 너비(x축 방향)와 높이(y축 방향)로 유일하게 식별된다. 아래 그림은 첫 번째 예제를 나타낸 것이다.

Mirko는 각 직사각형을 특정 색으로 칠했고, 이제 종이에서 색칠된 부분의 넓이를 알고 싶어 한다. 다시 말해, 적어도 하나의 직사각형에 속하는 단위 정사각형의 개수를 알고 싶어 한다.

제약

전체 점수의 40%에 해당하는 테스트 케이스에서는 입력의 모든 수가 3333보다 작다.
전체 점수의 50%에 해당하는 테스트 케이스에서는 어떤 직사각형도 다른 직사각형의 내부에 완전히 포함되지 않는다.

입력 형식

입력의 첫째 줄에 직사각형의 개수인 정수 \(N\)

(1 ≤ \(N\)

≤ 1 000 000)이 주어진다.
다음 \(N\)개의 줄에는 짝수 정수 \(X\)\(Y\) (2 ≤ X, \(Y \le 10\) {7}{ })가 주어진다. 해당 직사각형의 크기(각각 너비와 높이)이다.

출력 형식

출력의 첫째 줄이자 유일한 줄에 요구하는 넓이를 출력해야 한다.

예제 1
입력
1 s / 64 MB / 100 points

3
8 2
4 4
2 6

5
2 10
4 4
2 2
8 8
6 6
출력
output
28

68





Task Ronald
1 s / 64 MB / 120 points

There are ​N
​
 cities in one country that are connected with two-way air links. One crazy airline
president, Ronald Krump, often changes the flight schedule. More precisely, every day he
does the following:

●
chooses one of the cities,
●
introduces flights from that city towards all other cities where these flights do not
currently exist, and at the same time cancels all existing flights from that city

For instance, if from city 5 flights exist towards cities 1 and 2, but not towards cities 3 and 4,
after Krump’s change, there will exist flights from city 5 towards cities 3 and 4, but not
towards cities 1 and 2.

The citizens of this country are wondering if a day could come when the flight schedule will
be complete. In other words, when between each two different cities a (direct) flight will exist.
Write a programme that will, based on the current flight schedule, determine whether it is
possible to have a ​Complete Day
​
, or whether this will never happen, no matter what moves
Krump makes.
예제 2
입력
The first line of input contains the integer ​N
​
 (2 ≤ ​N
​
≤ 1000), the number of cities. The cities
are labeled with numbers from 1 to ​N
​
.
The second line contains the integer ​M
​
 (0 ≤ ​M
​
< ​N*(N-1)/2
​
), the number of current flights.
Each of the following ​M
​
 lines contains two different numbers, the labels of the cities that are
currently connected.
출력
The first and only line of output must contain DA (Croatian for “yes”) or NE (Croatian for
“no”).

SAMPLE TESTS
예제 3
입력
2
0

3
2
1 2
2 3

4
2
1 3
2 4
출력
output
output
DA

NE

DA





Task Ronald
1 s / 64 MB / 120 points
설명

Clarification of the first test case: In the first step, Krump will introduce the (only possible) line 1-2.
Clarification of the third case: If Krump first chooses city 1, flights 1-2, 1-4 and 2-4 will exist. If he
then chooses city 3, the flight schedule will become complete.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2016/2017 Contest 5

평가 및 의견

Unija

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Unija

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8