AtCoder Grand Contest 075
E
Many Optimization Problems
AtCoder
未评级
原题
← D→
翻译中…

Problem Statement

翻译中…

Optimization Problem

You are given a length-$N$ sequence of non-negative integers $A=(A_1,A_2,\dots,A_N)$. Also, there is a length-$N+1$ sequence of non-negative integers $X=(0,0,\dots,0)$.

You will now perform the following operation for $i=1,2,\dots,N$:

  • Choose an integer $v$ satisfying $0 \le v \le A_i$, and add $v$ and $A_i-v$ to $X_i$ and $X_{i+1}$, respectively.

Find the minimum possible value of the maximum value of $X$ at the end of the operations.

翻译中…

You are given positive integers $N$, $M$, and a prime number $P$. Find the sum, modulo $P$, of the answers to the Optimization Problem for all sequences $A=(A_1,A_2,\dots,A_N)$ of non-negative integers with length $N$ and sum $M$.

翻译中…

Constraints

翻译中…
  • $1 \le N \le 100$
  • $1 \le M \le 10^{18}$
  • $9 \times 10^8 \le P \le 10^9$
  • $P$ is prime.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N M P

翻译中…

Output

翻译中…

Output the sum, modulo $P$, of the answers to the Optimization Problem.

翻译中…

样例

Input #1
3 3 998244353
Output #1
13
For example, we solve the **Optimization Problem** for $A=(1,0,2)$. Here is a possible sequence of operations: - For $i = 1$, let $v = 1$. $X$ becomes $(1,0,0,0)$. - For $i = 2$, let $v = 0$. $X$ remains $(1,0,0,0)$. - For $i = 3$, let $v = 1$. $X$ becomes $(1,0,1,1)$. Since the maximum value of $X$ cannot be made $0$ or less, the answer is $1$. There are six other sequences with answer $1$ and three sequences with answer $2$, so the sum is $13$.
Input #2
10 135 998244353
Output #2
679877945
Input #3
100 1000000000000000000 924844033
Output #3
789282612
题目信息
题号
agc075_e
时间限制
5 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。