test/cpv/library-checker-string/enumerate_palindromes.mintd-md.hashstr-hashstr2d.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/enumerate_palindromes | ||
| 3 | #include "../../../src/util/alias/num/lib.hpp" | ||
| 4 | |||
| 5 | using namespace tifa_libs; | ||
| 6 | CEXP u32 MOD = 998244353; | ||
| 7 | |||
| 8 | #include "../../../src/math/ds/mint/md/lib.hpp" | ||
| 9 | #include "../../../src/str/hash/substr2/lib.hpp" | ||
| 10 | |||
| 11 | using namespace tifa_libs; | ||
| 12 | using mint = mint_md<__LINE__>; | ||
| 13 | using namespace tifa_libs; | ||
| 14 | using mint0 = mint_md<__LINE__>; | ||
| 15 | using mint1 = mint_md<__LINE__>; | ||
| 16 | using hashstr = hash_substr2<mint0, mint1>; | ||
| 17 | |||
| 18 | 24 | int main() { | |
| 19 | 24 | mint::set_mod(MOD); | |
| 20 | 24 | mint0::set_mod(998244353); | |
| 21 | 24 | mint1::set_mod(1000000007); | |
| 22 |
1/2✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 23 | 24 | strn s; | |
| 24 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | std::cin >> s; |
| 25 | { | ||
| 26 | 24 | strn x; | |
| 27 |
1/2✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | x.reserve(s.size() * 2 + 1); |
| 28 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | x.push_back('$'); |
| 29 |
4/6✓ Branch 4 taken 6615216 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6615216 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 6615216 times.
✓ Branch 12 taken 24 times.
|
6615240 | for (char c : s) x.push_back(c), x.push_back('$'); |
| 30 | 24 | s.swap(x); | |
| 31 | 24 | } | |
| 32 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | strn t = s; |
| 33 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | std::ranges::reverse(t); |
| 34 | 24 | hashstr hs, ht; | |
| 35 | 24 | hs.set(s), ht.set(t); | |
| 36 | 24 | u32 n = (u32)s.size(); | |
| 37 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | vecu ans(n); |
| 38 |
2/2✓ Branch 0 taken 13230456 times.
✓ Branch 1 taken 24 times.
|
13230480 | flt_ (u32, i, 0, n) { |
| 39 | 13230456 | u32 l = 0, r = std::min(i, n - 1 - i) + 1; | |
| 40 |
2/2✓ Branch 0 taken 229876604 times.
✓ Branch 1 taken 13230456 times.
|
243107060 | while (l + 1 < r) { |
| 41 | 229876604 | u32 m = (l + r) / 2, l_ = i - m, r_ = i + m; | |
| 42 |
2/2✓ Branch 3 taken 94194660 times.
✓ Branch 4 taken 135681944 times.
|
229876604 | (hs.get(l_, r_ + 1 - l_) == ht.get(n - 1 - r_, r_ + 1 - l_) ? l : r) = m; |
| 43 | } | ||
| 44 | 13230456 | ans[i] = l; | |
| 45 | } | ||
| 46 |
4/6✓ Branch 2 taken 13230408 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 13230408 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13230408 times.
✓ Branch 8 taken 24 times.
|
13230432 | for (u32 i = 1; i < n - 1; ++i) std::cout << ans[i] << " \n"[i + 2 == n]; |
| 47 | 24 | return 0; | |
| 48 | 24 | } | |
| 49 |