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

Boat

설명

In the city of Seoul, the Han River flows east to west. On the northern shore there are \(N\) boating schools, numbered \(1\) to \(N\) from west to east.

For a festival the schools send boats onto the river. Boats from the same school are identical; boats from different schools are distinguishable. School \(i\) may either send no boats, or send some number of boats \(x_i\) with \(a_i \le x_i \le b_i\).

The schools that decide to send boats must do so in strictly increasing quantity from west to east: if schools \(i < j\) both send boats then the number sent by school \(i\) must be strictly less than the number sent by school \(j\).

Count the number of distinct ways the schools can send boats to the festival (a school sending no boats is one of the possibilities), and output the count modulo \(1\,000\,000\,007\).

제약

\(1 \le N \le 500\) and \(1 \le a_i \le b_i \le 10^9\).

  • Subtask 1 (9 points): \(a_i = b_i\) for every school (each school's number of boats, if it sends any, is fixed).
  • Subtask 2 (22 points): additional points, relaxing the restriction above.
  • Subtask 3 (27 points): additional points.
  • Subtask 4 (42 points): the general case, \(1 \le N \le 500\).

(Each subtask is scored all-or-nothing: its points are awarded only if every one of its test cases passes.)

입력 형식

The first line contains a single integer \(N\) — the number of schools.

Each of the next \(N\) lines contains two integers \(a_i\) and \(b_i\) \((1 \le a_i \le b_i \le 10^9)\), the inclusive range for the number of boats school \(i\) may send.

출력 형식

Output a single line containing the number of ways the schools can send boats, modulo \(1\,000\,000\,007\).

서브태스크
서브태스크점수설명

Subtask 1

9점

None

Subtask 2

22점

None

Subtask 3

27점

None

Subtask 4

42점

None

문제 정보

rip 작성

출처 APIO 2016

평가 및 의견

Boat

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Boat

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