[RC-06] ijk

Luogu
IDLGP8912
Time3000ms
Memory512MB
DifficultyP4
O2优化
给定一个序列 $[a_1,a_2,a_3,\dots,a_n]$,保证 $\forall i\in [2,n], a_i\ge a_{i-1}$。 计算有多少整数三元组 $(i,j,k)$ 满足: - $1\le i,j,k\le n$。 - $a_i\times j\times a_k=i+a_j+k$。 ## Input 第一行一个正整数 $n$。 第二行 $n$ 个正整数 $a_1,a_2,\dots,a_n$。保证 $a_i\ge a_{i-1}$。 ## Output 输出一行一个非负整数,为答案。 [samples] ## Note 本题有三个子任务。 所有数据均满足:$1\le n\le 10^6$,$1\le a_i\le 10^6$,$a_i\ge a_{i-1}$。 - 子任务 $1$($5$ 分):$n\le 500$。 - 子任务 $2$($5$ 分):$a_i\le 10 $。 - 子任务 $3$($90$ 分):无特殊限制。
Samples
Input #1
5
2 3 3 4 5
Output #1
3
Input #2
10
1 1 2 2 3 3 4 4 5 8
Output #2
25
API Response (JSON)
{
  "problem": {
    "name": "[RC-06] ijk",
    "description": {
      "content": "给定一个序列 $[a_1,a_2,a_3,\\dots,a_n]$,保证 $\\forall i\\in [2,n], a_i\\ge a_{i-1}$。 计算有多少整数三元组 $(i,j,k)$ 满足: - $1\\le i,j,k\\le n$。 - $a_i\\times j\\times a_k=i+a_j+k$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8912"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定一个序列 $[a_1,a_2,a_3,\\dots,a_n]$,保证 $\\forall i\\in [2,n], a_i\\ge a_{i-1}$。\n\n计算有多少整数三元组 $(i,j,k)$ 满足:\n\n- $1\\le i,j,k\\le n$。\n- $a_i\\times j\\times a_k=i+a_j+k$。\n\n## Input\n\n第一行一个正整数 $n$。\n\n第二行 $n$ 个正整数 $a_1...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments