RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0622

Grass Segments

Platinum I 플래티넘 I
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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\).

Problem credits: Benjamin Qi

제약

SCORING

  • Input 4-5: \(N \leq 5000\)
  • Inputs 6-11: \(k\) is the same for all intervals
  • Inputs 12-20: No additional constraints.

In addition, for Inputs 5, 7, ..., 19, \(r_i \leq 2N\) for all \(i\).

Problem credits: Benjamin Qi

입력 형식

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
출력
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
출력
3
3
2
2
예제 3
입력
5
8 10 2
4 9 2
3 7 4
5 7 1
2 7 1
출력
0
3
1
3
3
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2023-2024 > US Open > Gold

태그

평가 및 의견

Grass Segments

개요
출제자 난이도 Platinum I 플래티넘 I 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Grass Segments

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