結果
問題 |
No.2265 Xor Range Substring Sum Query
|
ユーザー |
![]() |
提出日時 | 2023-04-04 19:44:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 788 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 168,208 KB |
実行使用メモリ | 10,912 KB |
最終ジャッジ日時 | 2024-10-01 10:30:32 |
合計ジャッジ時間 | 8,381 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 TLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; struct node{ long long x, p2, p11; node(): x(0), p2(1), p11(1){ } node(int x): x(x), p2(2), p11(11){ } }; node op(node L, node R){ node ans; ans.x = (L.x * R.p11 + L.p2 * R.x) % MOD; ans.p2 = L.p2 * R.p2 % MOD; ans.p11 = L.p11 * R.p11 % MOD; return ans; } int main(){ int n; cin >> n; string S; cin >> S; int Q; cin >> Q; for (int i = 0; i < Q; i++){ int t; cin >> t; if (t == 1){ int x, y; cin >> x >> y; S[x] = '0' + y; } if (t == 2){ int L, R, X; cin >> L >> R >> X; R++; node ans; for (int j = L; j < R; j++){ ans = op(ans, node(S[j ^ X] - '0')); } cout << ans.x << endl; } } }