No.2265 Xor Range Substring Sum Query
問題文最終更新日: 2023-04-07 15:55:36
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 383
(順位表)
の他の問題:
Problem Statement
For a digit string $s$, define $f(s)$ as follows.
- Regard each of the $2^{|s|}-1$ non-empty, not necessarily contiguous, substrings of $s$ as an integer written in decimal notation; the value is the sum of these integers.
You are given a digit string $S=S_0 S_1 \ldots S_{2^n-1}$ of length $2^n$ and $Q$ queries. Process them.
1 x y: Replace $S_x$ with $y$.2 L R X: Let $T=S_{L\oplus X}S_{(L+1) \oplus X}S_{(L+2) \oplus X} \ldots S_{R\oplus X}$, and output $f(T)$ modulo $998244353$.
Here, $\oplus$ denotes the bitwise exclusive OR.
Input
$n$
$S$
$Q$
$\mathrm{query}_1$
$\mathrm{query}_2$
$\vdots$
$\mathrm{query}_Q$
Each query is given in one of the following $2$ formats.
$1\ x\ y$
$2\ L\ R\ X$
- $1\leq n\leq 18$
- $|S|=2^n$
- $1\leq S_i\leq 9 (0\leq i\lt 2^n)$
- $1\leq Q\leq 10^5$
- $0\leq x\lt 2^n, 1\leq y\leq 9$
- $0\leq L\leq R\lt 2^n, 0\leq X\lt 2^n$
- There is at least $1$ query of the $2$nd format.
- All input values are integers.
Output
Output the answers to the queries as instructed in the problem statement, separated by newlines.
Sample
Sample 1
Input
3 12345678 5 2 0 2 0 2 1 4 1 1 0 9 2 0 2 0 2 1 4 1
Output
177 2479 1145 13127
- Initially, $S$ is
12345678. - For the $1$st query, $T=S_{0\oplus 0}S_{1\oplus 0}S_{2 \oplus 0}=$
123, and $f($123$)=123+12+13+23+1+2+3=177$. - For the $2$nd query, $T=S_{1\oplus 1}S_{2\oplus 1}S_{3\oplus 1}S_{4\oplus 1}=$
1436. - For the $3$rd query, $S$ becomes
92345678. - For the $4$th query, $T=S_{0\oplus 0}S_{1\oplus 0}S_{2 \oplus 0}=$
923. - For the $5$th query, $T=S_{1\oplus 5}S_{2\oplus 5}S_{3\oplus 5}S_{4\oplus 5}=$
9436.
Sample 2
Input
4 6871158633369156 10 2 11 14 6 2 1 10 8 1 10 5 1 4 9 2 1 15 14 2 0 5 6 2 13 15 10 1 12 7 1 4 4 2 4 10 0
Output
2345 974835551 235766910 1518120 944 9236338
- Initially, $S$ is
6871158633369156. - For the $1$st query, $T=$
1363. - For the $2$nd query, $T=$
3369156687. - For the $3$rd query, $S$ becomes
6871158633569156. - For the $4$th query, $S$ becomes
6871958633569156. - For the $5$th query, $T=$
691563386957168. - For the $6$th query, $T=$
869571. - For the $7$th query, $T=$
695. - For the $8$th query, $S$ becomes
6871958633567156. - For the $9$th query, $S$ becomes
6871458633567156. - For the $10$th query, $T=$
4586335.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
とりゐ
SSRS
sotanishy