#491
Unrated
The Moo Particle
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Quarantined for their protection during an outbreak of COWVID-19, Farmer John's cows have come up with a new way to alleviate their boredom: studying advanced physics! In fact, the cows have even managed to discover a new subatomic particle, which they have named the "moo particle".

The cows are currently running an experiment involving NN moo particles (1N1051 \leq N \leq 10^5). Particle ii has a "spin" described by two integers xix_i and yiy_i in the range 109109-10^9 \ldots 10^9 inclusive. Sometimes two moo particles interact. This can happen to particles with spins (xi,yi)(x_i, y_i) and (xj,yj)(x_j, y_j) only if xixjx_i \leq x_j and yiyjy_i \leq y_j. Under these conditions, it's possible that exactly one of these two particles may disappear (and nothing happens to the other particle). At any given time, at most one interaction will occur.

The cows want to know the minimum number of moo particles that may be left after some arbitrary sequence of interactions.

입력

The first line contains a single integer NN, the initial number of moo particles. Each of the next NN lines contains two space-separated integers, indicating the spin of one particle. Each particle has a distinct spin.

출력

A single integer, the smallest number of moo particles that may remain after some arbitrary sequence of interactions.

예제 입력 1

4
1 0
0 1
-1 0
0 -1

예제 출력 1

1

예제 입력 2

3
0 0
1 1
-1 3

예제 출력 2

2

점수

Test cases 3-6 satisfy N1000.N\le 1000. Test cases 7-12 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.