原题面:
Then, print the number of non-empty strings, modulo 998244353, that can be obtained as a (not necessarily contiguous) subsequence of S after replacing each occurrence of ? in S with 0 or 1 independently.
询问有多少种非空子序列(不一定要相邻)。
翻译中翻译为了子串,建议改为:
给定长度为 N 的仅包含 0,1,? 的字符串 S,给定 Q 组询问 (x1,c1),(x2,c2),⋯,(xq,cq),每次将原字符串中 xi 位置的字符改为 ci,然后输出 S 有多少种非空子串,? 需任意替换为 0 或 1。
1≤N,Q≤105,1≤xi≤N。
给定长度为 $N$ 的仅包含 `0`,`1`,`?` 的字符串 $S$,给定 $Q$ 组询问 $(x_1, c_1), (x_2, c_2), \cdots, (x_q, c_q)$,每次将原字符串中 $x_i$ 位置的字符改为 $c_i$,然后输出 $S$ 有多少种非空子串,`?` 需任意替换为 `0` 或 `1`。
$1 \le N, Q \le 10^5, 1 \le x_i \le N$。
已经有一个帖子反馈过这个问题了:
https://www.luogu.com.cn/discuss/526585