Comments (5)
$p$ を$2^{31}−1$ や$2^{61}−1$ などの大きな素数でとりbaseを複数用意するローリングハッシュであれば制約内で衝突する確率は無視できるはずです。
文字列長が
とりあえずこんな感じで考えます.
長さ $N$ の文字列 $S$ が与えられます。以下の形式のクエリを $Q$ 回処理してください。
- $a, b, c, d$:$S_a\cdots S_{b-1}$ と $S_{c}\cdots S_{d-1}$ の一致判定をせよ。
制約
- $1\leq N \leq 10^6$, $1\leq Q\leq 10^6$
- $0\leq a\leq b\leq N$, $0\leq c\leq d\leq N$
from library-checker-problems.
-
repetition 要素について
$a^c=b^d$ となるのは,$c,d$ が互いに素な場合に帰着したあと$a=s^d$ ,$b=s^c$ と書けるかの判定にできて,$a, b$ の prefix や suffix を適切に比較するだけでできるので,ほとんど$c=d=1$ 以上と同じことになります.この処理を問いたいという主旨の問題ならばそれでもよいですが,そうではなければ repetition 要素は無駄だと思います. -
Rolling Hash 解法について
長さ$n$ の文字列に対する衝突確率の評価は,$O(n/p)$ となります.例えば,同一の文字列が$p-1$ 個続くパターンaaa...aaa
やbbb...bbb
のハッシュはほとんどの base で$0$ となり,これらは$p$ を法とする Rolling Hash では区別されません.この点は考慮していますか?
純粋なロリハをverifyできる問題
というのがどのような意味を指しているか分かりませんが,
Z Algorithm:Rolling Hash で lcp を計算
Enumerate Palindromes:Rolling Hash で回文判定+二分探索
Suffix Array:Rolling Hash で suffix の比較関数を作ってソート
などの解法があって,利用しているユーザーはいます.
Rolling Hash が解法に使えることが,今以上に分かりやすい問題が欲しいという意味であれば,単に
あるいは(Repetition のように)Hash が結合可能であるという点を問いたいということであれば,文字列に変更クエリも与えて Rolling Hash をセグメント木に乗せるような設定を考える方が良いかもしれません(ただしこれは point_set_range_composite とほぼ同じ).
from library-checker-problems.
aaa...aaa
やbbb...bbb
のハッシュはほとんどの base で$0$ となり,これらは$p$ を法とする Rolling Hash では区別されません.この点は考慮していますか?
Rolling Hash が解法に使えることが,今以上に分かりやすい問題が欲しいという意味であれば,
説明不足でした。この意味です。
確かに部分文字列だけで十分かもしれません。
from library-checker-problems.
ありがとうございます。
(さっきの文章を書いてる時点で繰り返しのことが頭から抜けててすこしおかしなことを書いていました…)
from library-checker-problems.
ありがとうございます。
部分文字列一致判定クエリでお願いします。
from library-checker-problems.
Related Issues (20)
- [テストケース案] Cycle Detection (Directed) : long_cycle
- [誤植] Nim Product カンマ
- latex render seems broken in problem "Polynomial Root Finding (Mod 998244353)" HOT 1
- [テストケース案] Min Plus Convolution (Convex and Arbitrary)
- [問題案] Palindromes in Deque HOT 3
- [問題案] (Addition/Multiplication/Division of Hex Big Integers) HOT 1
- [問題案] Counting Square-free numbers HOT 2
- [テストケース案] Counting Primes HOT 6
- [問題案] composition of formal power series (Large), compositional_inverse_of_formal_power_series (Large) HOT 1
- [Problem proposal] Sum of Multiplicative Function HOT 6
- License file is broken
- [Problem proposal] Vertex Add Range Contour Max on Tree HOT 2
- [テストケース案] Matching on Bipartite Graph HOT 2
- テストケース追加(convolution mod 2^64)
- [機能案] library checker の双対 HOT 2
- [問題案] Point Set Tree Path Rooted Composite Sum HOT 4
- [Problem proposal] (Range Add Range Sum) HOT 4
- テストケース Range Chmin Chmax Add Range Sum HOT 3
- [問題案] Point Set Tree Path Composite Sum HOT 2
- 問題案:2変数 FPS operations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from library-checker-problems.