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

Smaller Averages

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

의견: 0

설명

Bessie has two arrays of length \(N\) (\(1 \le N \le 500\)). The \(i\)-th element of
the first array is \(a_i\) (\(1 \le a_i \le 10^6\)) and the \(i\)-th element of the
second array is \(b_i\) (\(1 \le b_i \le 10^6\)).

Bessie wants to split both arrays into non-empty subarrays such that the
following is true.

  1. Every element belongs in exactly 1 subarray.
  2. Both arrays are split into the same number of subarrays. Let the number of subarrays the first and second array are split into be \(k\) (i.e. the first array is split into exactly \(k\) subarrays and the second array is split into exactly \(k\) subarrays).
  3. For all \(1 \le i \le k\), the average of the \(i\)-th subarray on the left of the first array is less than or equal to the average of the \(i\)-th subarray on the left of the second array.

Count how many ways she can split both arrays into non-empty subarrays while
satisfying the constraints modulo \(10^9+7\). Two ways are considered different if
the number of subarrays are different or if some element belongs in a different
subarray.

Problem credits: Alex Liang

제약

SCORING

  • Inputs 5-6: \(N \le 10\)
  • Inputs 7-9: \(N \le 80\)
  • Inputs 10-17: \(N \le 300\)
  • Inputs 18-20: \(N \le 500\)

Problem credits: Alex Liang

입력 형식

The first line contains \(N\).

The next line contains \(a_1,a_2,...,a_N\).

The next line contains \(b_1,b_2,...,b_N\).

출력 형식

Output the number of ways she can split both arrays into non-empty subarrays
while satisfying the constraints modulo \(10^9+7\).

예제 1
입력
2
1 2
2 2
출력
2
설명

The two valid ways are:

  1. Split the first array into \([1],[2]\) and the second array into \([2],[2]\).
  2. Split the first array into \([1,2]\) and the second array into \([2,2]\).
예제 2
입력
3
1 3 2
2 2 2
출력
3
설명

The three valid ways are:

  1. Split the first array into \([1,3],[2]\) and the second array into \([2,2],[2]\).
  2. Split the first array into \([1,3],[2]\) and the second array into \([2],[2,2]\).
  3. Split the first array into \([1,3,2]\) and the second array into \([2,2,2]\).
예제 3
입력
5
2 5 1 3 2
2 1 5 2 2
출력
1
설명

The only valid way is to split the first array into \([2],[5,1,3],[2]\) and the
second array into \([2],[1,5],[2,2]\).

예제 4
입력
7
3 5 2 3 4 4 1
5 3 5 3 3 4 1
출력
140
문제 정보

riseoj 작성

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

태그

평가 및 의견

Smaller Averages

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

Log in to rate problems.

개별 의견

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

풀이 제출

Smaller Averages

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