{"problem":{"name":"Visibility Sequence","description":{"content":"There are $N$ buildings under construction arranged in a row, numbered $1, 2, \\ldots, N$ from left to right. Given is an integer sequence $X$ of length $N$. The height of Building $i$, $H_i$, can be o","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_f"},"statements":[{"statement_type":"Markdown","content":"There are $N$ buildings under construction arranged in a row, numbered $1, 2, \\ldots, N$ from left to right.\nGiven is an integer sequence $X$ of length $N$. The height of Building $i$, $H_i$, can be one of the integers between $1$ and $X_i$ (inclusive).\nFor each $i$ such that $1 \\leq i \\leq N$, let us define $P_i$ as follows:\n\n*   If there is an integer $j (1 \\leq j < i)$ such that $H_j > H_i$, $P_i$ is the maximum such $j$. Otherwise, $P_i$ is $-1$.\n\nConsidering all possible combinations of the buildings' heights, find the number of integer sequences that $P$ can be, modulo $1000000007$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   $1 \\leq X_i \\leq 10^5$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$X_1$ $X_2$ $\\cdots$ $X_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc104_f","tags":[],"sample_group":[["3\n3 2 1","4\n\nWe have six candidates for $H$, as follows:\n\n*   $H = (1, 1, 1)$, for which $P$ is $(-1, -1, -1)$;\n*   $H = (1, 2, 1)$, for which $P$ is $(-1, -1, 2)$;\n*   $H = (2, 1, 1)$, for which $P$ is $(-1, 1, 1)$;\n*   $H = (2, 2, 1)$, for which $P$ is $(-1, -1, 2)$;\n*   $H = (3, 1, 1)$, for which $P$ is $(-1, 1, 1)$;\n*   $H = (3, 2, 1)$, for which $P$ is $(-1, 1, 2)$.\n\nThus, there are four integer sequences that $P$ can be: $(-1, -1, -1), (-1, -1, 2), (-1, 1, 1)$, and $(-1, 1, 2)$."],["3\n1 1 2","1\n\nWe have two candidates for $H$, as follows:\n\n*   $H = (1, 1, 1)$, for which $P$ is $(-1, -1, -1)$;\n*   $H = (1, 1, 2)$, for which $P$ is $(-1, -1, -1)$.\n\nThus, there is one integer sequence that $P$ can be."],["5\n2 2 2 2 2","16"],["13\n3 1 4 1 5 9 2 6 5 3 5 8 9","31155"]],"created_at":"2026-03-03 11:01:14"}}