3 1 2 3
2
$X$ becomes one of the following, with probability $1/6$ for each:
* $X = (1,1,1)$, for which the length of the longest increasing subsequence is $1$;
* $X = (1,1,2)$, for which the length of the longest increasing subsequence is $2$;
* $X = (1,1,3)$, for which the length of the longest increasing subsequence is $2$;
* $X = (1,2,1)$, for which the length of the longest increasing subsequence is $2$;
* $X = (1,2,2)$, for which the length of the longest increasing subsequence is $2$;
* $X = (1,2,3)$, for which the length of the longest increasing subsequence is $3$.
Thus, the expected value of the length of the longest increasing subsequence is $(1 + 2 + 2 + 2 + 2 + 3) / 6 \equiv 2 \pmod {1000000007}$.3 2 1 2
500000005
$X$ becomes one of the following, with probability $1/4$ for each:
* $X = (1,1,1)$, for which the length of the longest increasing subsequence is $1$;
* $X = (1,1,2)$, for which the length of the longest increasing subsequence is $2$;
* $X = (2,1,1)$, for which the length of the longest increasing subsequence is $1$;
* $X = (2,1,2)$, for which the length of the longest increasing subsequence is $2$.
Thus, the expected value of the length of the longest increasing subsequence is $(1 + 2 + 1 + 2) / 4 = 3 / 2$. Since $2 \times 500000005 \equiv 3 \pmod {1000000007}$, we should print $500000005$.6 8 6 5 10 9 14
959563502
{
"problem": {
"name": "Random LIS",
"description": {
"content": "Given is an integer sequence of length $N$: $A_1, A_2, \\cdots, A_N$. An integer sequence $X$, which is also of length $N$, will be chosen randomly by independently choosing $X_i$ from a uniform distri",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc104_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Given is an integer sequence of length $N$: $A_1, A_2, \\cdots, A_N$.\nAn integer sequence $X$, which is also of length $N$, will be chosen randomly by independently choosing $X_i$ from a uniform distri...",
"is_translate": false,
"language": "English"
}
]
}