3 1 2 3
4
The following four permutations satisfy the condition:
* $(1, 2, 3)$
* $(1, 3, 2)$
* $(3, 2, 1)$
* $(2, 1, 3)$
For example, $(1, 3, 2)$ satisfies the condition because $p_1 = 1$, $p_{p_2} = 2$ and $p_{p_3} = 3$.2 1 1
1 The following one permutation satisfies the condition: * $(2, 1)$
3 2 1 1
2 The following two permutations satisfy the condition: * $(2, 3, 1)$ * $(3, 1, 2)$
3 1 1 1
0
13 2 1 4 3 6 7 5 9 10 8 8 9 11
6
{
"problem": {
"name": "Next or Nextnext",
"description": {
"content": "You are given an integer sequence $a$ of length $N$. How many permutations $p$ of the integers $1$ through $N$ satisfy the following condition? * For each $1 ≤ i ≤ N$, at least one of the following",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc008_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given an integer sequence $a$ of length $N$. How many permutations $p$ of the integers $1$ through $N$ satisfy the following condition?\n\n* For each $1 ≤ i ≤ N$, at least one of the following...",
"is_translate": false,
"language": "English"
}
]
}