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

31767번 - Grass Segments 다국어

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

문제

Bessie is planting some grass on the positive real line. She has $N$ (2ドル\le N\le 2\cdot 10^5$) different cultivars of grass, and will plant the $i$th cultivar on the interval $[\ell_i, r_i]$ (0ドル < \ell_i < r_i \leq 10^9$).

In addition, cultivar $i$ grows better when there is some cultivar $j$ ($j\neq i$) such that cultivar $j$ and cultivar $i$ overlap with length at least $k_i$ (0ドル < k_i \leq r_i - \ell_i$). Bessie wants to evaluate all of her cultivars. For each $i,ドル compute the number of $j\neq i$ such that $j$ and $i$ overlap with length at least $k_i$.

입력

The first line contains $N$.

The next $N$ lines each contain three space-separated integers $\ell_i,ドル $r_i,ドル and $k_i$.

출력

The answers for all cultivars on separate lines.

제한

예제 입력 1

2
3 6 3
4 7 2

예제 출력 1

0
1

The overlaps of the cultivars is $[4,6],ドル which has length 2ドル,ドル which is at least 2ドル$ but not at least 3ドル$.

예제 입력 2

4
3 6 1
2 5 1
4 10 1
1 4 1

예제 출력 2

3
3
2
2

예제 입력 3

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

예제 출력 3

0
3
1
3
3

힌트

출처

Olympiad > USA Computing Olympiad > 2023-2024 Season > USACO 2024 US Open Contest > Gold 2번

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

출처

대학교 대회

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

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