No.2794 I Love EDPC-T
問題文最終更新日: 2024-05-31 20:34:49
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 434
(順位表)
の他の問題:
Problem Statement
You are given a string $s$ of length $N-1$. $s$ consists of < and >.
How many permutations $(p_1,p_2,\ldots,p_N)$ of $(1,2,\ldots,N)$ satisfy all of the following conditions? Find the count modulo $998244353$.
-
For each $i \ (1\le i\le N-1)$, if the $i$-th character of $s$ is
<, then $p_i\lt p_{i+1}$, and if it is>, then $p_i\gt p_{i+1}$. - The length of the longest increasing subsequence of $(p_1,p_2,\ldots,p_N)$ is $2$.
Constraints
- $N$ is an integer between $2$ and $2\times 10^5$, inclusive
- $s$ is a string of length $N-1$ consisting of
<and>
Input
The input is given from Standard Input in the following format.$N$ $s$
Output
Print the number of permutations satisfying all of the conditions, modulo $998244353$.
Sample
Sample 1
Input
4 <><
Output
2
$(2,4,1,3),(3,4,1,2)$ satisfy the conditions.
Sample 2
Input
5 <<<<
Output
0
Sample 3
Input
35 ><>><>>><>>>><>>>>><>>>>>><>>>>>>>
Output
592821357
Find the count modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。