Max Prod Plus

AtCoder
IDagc075_d
Time3000ms
Memory256MB
Difficulty
For a length-$N$ sequence of positive integers $A=(A_1,A_2,\dots,A_N)$, define $f(A)$ as follows: * The maximum value of $A_iA_j + A_k$ over all triples of integers $(i,j,k)$ satisfying $1 \le i < j < k \le N$. Find the number, modulo $998244353$, of length-$N$ sequences $A$ of positive integers with all elements between $1$ and $M$, inclusive, such that $f(A) \le K$. ## Constraints * $3 \le N \le 10^9$ * $1 \le M,K \le 10^4$ ## Input The input is given from Standard Input in the following format: $N$ $M$ $K$ [samples]
Samples
Input #1
3 5 4
Output #1
9

The sequences satisfying the condition are $(1,1,1),(1,1,2),(1,2,1),(2,1,1),(1,1,3),(1,2,2),(2,1,2),(1,3,1),(3,1,1)$, which is nine sequences.
Input #2
4 5 7
Output #2
66
Input #3
123 456 789
Output #3
436486661
Input #4
1000000000 10000 10000
Output #4
855626126
API Response (JSON)
{
  "problem": {
    "name": "Max Prod Plus",
    "description": {
      "content": "For a length-$N$ sequence of positive integers $A=(A_1,A_2,\\dots,A_N)$, define $f(A)$ as follows: *   The maximum value of $A_iA_j + A_k$ over all triples of integers $(i,j,k)$ satisfying $1 \\le i < ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "agc075_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For a length-$N$ sequence of positive integers $A=(A_1,A_2,\\dots,A_N)$, define $f(A)$ as follows:\n\n*   The maximum value of $A_iA_j + A_k$ over all triples of integers $(i,j,k)$ satisfying $1 \\le i < ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments