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

34790번 - Pair Linked Mokepon 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB333100.000%

문제

The popular game of Mokepon can be represented as a list of $n$ stations with special items located at them and a player beginning at station 1ドル$. Each item has an identifier id (2ドル\le$id$\le n$) (and no two items may have the same identifier), and the player is required to have the item with identifier $i$ to be able to move to station $i$ from station $i - 1$. Stations may have multiple (including none) items, and the player can pick up and hold an unlimited number of items. The objective is to reach the last station: station $n$.

You and your friend find this game too easy, so you decide to link up two games of Mokepon: your game has $n_{\text{A}}$ stations and your friend's game has $n_{\text{B}}$ stations. However, special items may appear in either game, and are now uniquely identified by the pair of $($id,ドル \text{A or B})$: its identifier, and which game it comes from. To progress to station $i$ in a given game, either one of you must have picked up the item with identifier $i$ for that game.

The games randomize where items gets placed in each of the game, and so not every placement of items may be possible to win from. Your goal is to count the number of distributions of items such that it is possible for the two of you to both reach the end station in your respective games. Since this number may be large, calculate it modulo a prime $p$.

We say two distributions of items to stations are different if there is at least one station where the set of items at that station differ.

입력

The only line of input contains three integers, $n_\text{A},ドル $n_\text{B},ドル and $p$ ( 2ドル\le n_\text{A}, n_\text{B}\le 3\cdot 10^3,ドル 10ドル^8\le p\le 10^9 + 7$) --- the number of stations in your and your friend's game, respectively, and the modulo to calculate with respect to.

It is guaranteed that $p$ is a prime.

출력

Output a single integer, the number of distributions of items such that both players win their respective games, modulo $p$.

제한

예제 입력 1

2 2 1000000007

예제 출력 1

8

예제 입력 2

15 20 998244353

예제 출력 2

937612

노트

In the first sample, there are two special items: $(2, \text{A})$ and $(2, \text{B})$ corresponding to the two games $\text{A}$ and $\text{B}$ respectively, and thus 4ドル^2 = 16$ configurations of stations where they could be located. The eight winning possibilities (in the notation (station, game)) are listed below, along with illustrations of the first two possibilities.

  • $(1, A)$; $(1, A)$: Both players can immediately progress to their respective end stations.
  • $(1, A)$; $(2, A)$: The first player unlocks their final station, at which point the second player can progress.
  • $(1, A)$; $(1, B)$
  • $(1, B)$; $(1, A)$
  • $(1, B)$; $(1, B)$
  • $(1, B)$; $(2, A)$
  • $(2, B)$; $(1, A)$
  • $(2, B)$; $(1, B)$

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2025 ICPC Pacific Northwest Regional > Division 1 I번

  • 문제를 만든 사람: Jerry Li
(追記) (追記ここまで)

출처

대학교 대회

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

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