{"problem":{"name":"Drop Min","description":{"content":"There is a permutation $P$ of $(1,2,\\ldots,N)$ and an empty array $A$. Perform the following operation $N-1$ times on $P$: *   Choose two adjacent elements. Remove the smaller of the chosen elements ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc212_e"},"statements":[{"statement_type":"Markdown","content":"There is a permutation $P$ of $(1,2,\\ldots,N)$ and an empty array $A$. Perform the following operation $N-1$ times on $P$:\n\n*   Choose two adjacent elements. Remove the smaller of the chosen elements from $P$ and concatenate the parts before and after the removed element. Append the removed element to the end of $A$.\n\nFind the number, modulo $998244353$, of possible final sequences $A$ of length $N-1$.\n\n## Constraints\n\n*   $2 \\le N \\le 2\\times 10^5$\n*   $1 \\le P_i \\le N$\n*   $P$ is a permutation of $(1,2,\\ldots,N)$.\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$P_1$ $P_2$ $\\ldots$ $P_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc212_e","tags":[],"sample_group":[["4\n1 2 3 4","6\n\nAll six permutations of $(1,2,3)$ are possible as the final $A$.\nFor example, $A=(2,1,3)$ can be obtained as follows:\n\n*   Choose $2,3$. Remove $2$, and now $P=(1,3,4), A=(2)$.\n*   Choose $1,3$. Remove $1$, and now $P=(3,4), A=(2,1)$.\n*   Choose $3,4$. Remove $3$, and now $P=(4), A=(2,1,3)$."],["3\n3 1 2","1"],["24\n10 24 3 4 8 14 5 2 22 9 21 1 15 6 13 23 18 12 7 17 19 16 20 11","303178128"]],"created_at":"2026-03-03 11:01:13"}}