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

Supervision

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

의견: 0

설명

There are \(N\) (\(1\le N \leq 10^6\)) cows in cow camp, labeled \(1\dots N\). Each
cow is either a camper or a coach.

A nonempty subset of the cows will be selected to attend a field trip. If the
\(i\)th cow is selected, the cow will move to position \(p_i\)
(\(0\le p_i \leq 10^9\)) on a number line, where the array \(p\) is strictly
increasing.

A nonempty subset of the cows is called "good" if for every selected camper,
there is a selected coach within \(D\) units to the left, inclusive
(\(0\le D\le 10^9\)). How many good subsets are there, modulo \(10^9+7\)?

Problem credits: Agastya Goel, Eva Zhu, and Benjamin Qi

제약

SCORING

  • Input 3: \(N=20\)
  • Input 4: \(D=0\)
  • Inputs 5-8: \(N\le 5000\)
  • Inputs 9-16: No additional constraints.

Problem credits: Agastya Goel, Eva Zhu, and Benjamin Qi

입력 형식

The first line contains two integers \(N\) and \(D\).

The next \(N\) lines each contain two integers \(p_i\) and \(o_i\). \(p_i\) denotes the
position the \(i\)th cow will move to. \(o_i=1\) means the \(i\)th cow is a coach,
whereas \(o_i=0\) means the \(i\)th cow is a camper.

It is guaranteed that the \(p_i\) are given in strictly increasing order.

출력 형식

Output the number of good subsets modulo \(10^9 + 7\).

예제 1
입력
6 1
3 1
4 0
6 1
7 1
9 0
10 0
출력
11
설명

The last two campers can never be selected. All other nonempty subsets work as
long as if cow \(2\) is selected, then cow \(1\) is also selected.

예제 2
입력
20 24
3 0
14 0
17 1
20 0
21 0
22 1
28 0
30 0
32 0
33 1
38 0
40 0
52 0
58 0
73 0
75 0
77 1
81 1
84 1
97 0
출력
13094
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2025-2026 > First Contest > Gold

태그

평가 및 의견

Supervision

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

Log in to rate problems.

개별 의견

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

풀이 제출

Supervision

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