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

20598번 - Justice For Everyone 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 512 MB554100.000%

문제

Suppose you have $n$ pairwise different numbers on a desk, denoted by $a_1, a_2, \ldots, a_n$ (order matters). In one turn, you can choose two different indices $i_1 < i_2$ and simultaneously increase $a_{i_1}$ and $a_{i_2}$ by one. The only condition is that the numbers on the desk should be different in every moment. Your task is to find the number of ways to obtain pairwise different numbers $b_1, b_2, \ldots, b_n$ (in exactly this order). As this number can be very large, print it modulo 998ドル,244円,353円$.

입력

The first line of the input contains a single integer $n$ (1ドル \le n \le 30$). The second and the third lines of the input contain $n$ space-separated integers each: the arrays $a_i$ and $b_i$ respectively (1ドル \le a_i, b_i \le 200$). All $a_i$ are guaranteed to be pairwise different, same for $b_i$.

출력

Print the answer modulo prime number 998ドル,244円,353円$.

제한

예제 입력 1

3
1 2 3
3 4 5

예제 출력 1

1

예제 입력 2

3
1 2 3
7 8 9

예제 출력 2

42

예제 입력 3

3
1 4 7
3 6 9

예제 출력 3

6

힌트

In the first sample, the only way is to make operations in the order $\{2, 3\}, \{1, 3\}, \{1, 2\}$.

In the third sample, we can make the three operations $\{1, 2\}, \{2, 3\}, \{1, 3\}$ in any order.

출처

Camp > Petrozavodsk Programming Camp > Summer 2020 > Day 2: SPb SU LOUD ENOUGH Contest J번

Contest > Open Cup > 2020/2021 Season > Stage 2: SPb SU LOUD ENOUGH Contest J번

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

출처

대학교 대회

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

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