Skip to content

Commit

Permalink
2024.10.21 更新:v1.8.7 封包版本上传
Browse files Browse the repository at this point in the history
  • Loading branch information
hh2048 authored Oct 21, 2024
1 parent 58d1909 commit 438e310
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 128 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/** 马拉车(Manacher, with string)
* 2024-04-06: https://qoj.ac/submission/380047
* 2024-04-09: https://qoj.ac/submission/384389 【模板】
**/
std::vector<int> manacher(std::string s) {
std::string t = "#";
for (auto c : s) {
t += c;
t += '#';
}
int n = t.size();
std::vector<int> r(n);
for (int i = 0, j = 0; i < n; i++) {
if (2 * j - i >= 0 && j + r[j] > i) {
r[i] = std::min(r[2 * j - i], j + r[j] - i);
}
while (i - r[i] >= 0 && i + r[i] < n && t[i - r[i]] == t[i + r[i]]) {
r[i] += 1;
}
if (i + r[i] > j + r[j]) {
j = i;
}
}
return r;
}

/** 马拉车(Manacher, with vector)
* 2024-04-14: https://atcoder.jp/contests/abc349/submissions/52365777
**/
std::vector<int> manacher(std::vector<int> s) {
std::vector<int> t{0};
for (auto c : s) {
t.push_back(c);
t.push_back(0);
}
int n = t.size();
std::vector<int> r(n);
for (int i = 0, j = 0; i < n; i++) {
if (2 * j - i >= 0 && j + r[j] > i) {
r[i] = std::min(r[2 * j - i], j + r[j] - i);
}
while (i - r[i] >= 0 && i + r[i] < n && t[i - r[i]] == t[i + r[i]]) {
r[i] += 1;
}
if (i + r[i] > j + r[j]) {
j = i;
}
}
return r;
}

This file was deleted.

3 changes: 1 addition & 2 deletions 03 - jiangly模板收集/05 - 字符串/02 - Z函数.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ std::vector<int> Z(std::string s) {
}
}
return z;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ struct SuffixArray {
}
}
}
};

};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/** 后缀自动机(SuffixAutomaton 旧版)
* 2022-08-17: https://ac.nowcoder.com/acm/contest/view-submission?submissionId=53409023&returnHomeType=1&uid=329687984
**/
struct SuffixAutomaton {
static constexpr int ALPHABET_SIZE = 26, N = 5e5;
struct Node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ struct SAM {
int size() {
return t.size();
}
};

};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/** AC自动机(AC 旧版)
* 2021-07-07: https://codeforces.com/contest/710/submission/121661266
**/
constexpr int N = 3e5 + 30, A = 26;

struct Node {
Expand Down Expand Up @@ -72,5 +75,4 @@ struct AC {
}
return ans;
}
};

};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/** AC自动机(AhoCorasick, with vector 新版)
* 2023-04-07: https://codeforces.com/contest/1801/submission/201155712
**/
struct AhoCorasick {
static constexpr int ALPHABET = 26;
struct Node {
Expand Down Expand Up @@ -82,5 +85,4 @@ struct AhoCorasick {
int size() {
return t.size();
}
};

};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** AC自动机(AhoCorasick 新新版
/** AC自动机(AhoCorasick, with string 新版
* 2024-04-09: https://www.luogu.com.cn/record/155114676 【模板】
**/
struct AhoCorasick {
Expand Down Expand Up @@ -74,4 +74,4 @@ struct AhoCorasick {
int size() {
return t.size();
}
};
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/** 字符串哈希(随机底模例题)
* 2022-06-09: https://codeforces.com/contest/1598/submission/160006998
**/

#include <bits/stdc++.h>

using i64 = long long;
Expand Down Expand Up @@ -110,5 +114,4 @@ int main() {
}

return 0;
}

}

This file was deleted.

0 comments on commit 438e310

Please sign in to comment.