Logo
(追記) (追記ここまで)

27201번 - One-dimensional Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB138777.778%

문제

Bogdan is playing a game. The game is one-dimensional --- there are $n$ platforms located on the horizontal line. Bogdan can move between platforms. The $i$-th platform is a horizontal segment $[l_i, r_i]$. All segments are distinct.

Let's say that the platform $j$ is inside the platform $i$ if $l_i \le l_j$ and $r_j \le r_i$.

At the beginning of the game, Bogdan chooses the platform from which he will start his journey. Moving between platforms is dangerous and Bogdan tries to stay away from the danger, so he can move from the platform $i$ to the platform $j$ only if the platform $j$ is inside the platform $i$ and there is no other platform $k,ドル which is inside the platform $i$ and the platform $j$ is inside the platform $k$.

For each platform Bogdan wants to know how many different paths he can take, starting from this platform and ending on any other. To paths are different if there is a platform, which is in the one of the paths but not in the other one.

Help Bogdan count the number of paths from each platform. Since the number of paths can be very large, find it modulo 10ドル^9 + 7$.

입력

The first line contains the only integer $n$ (1ドル \le n \le 3 \cdot 10^5$) --- the number of platforms.

The next $n$ lines contains the platforms' data, the $i$-th of these lines contains two integers $l_i$ and $r_i$ (1ドル \le l_i \le r_i \le 10^9$) --- the ends of the $i$-th segment of the platform.

출력

Print $n$ integers, the $i$-th integer must be equal to the number of different paths from the platform $i,ドル modulo 10ドル^9 + 7$.

제한

예제 입력 1

5
1 5
1 4
1 3
1 2
1 1

예제 출력 1

5 4 3 2 1

예제 입력 2

4
3 3
1 4
1 5
2 5

예제 출력 2

1 2 5 2

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2022 H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /