Skip to content

Commit b3bf204

Browse files
committed
fix wildcard test
1 parent 0ce70c0 commit b3bf204

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

cp-algo/util/big_alloc.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,8 @@ namespace cp_algo {
6363

6464
template<typename T>
6565
using big_vector = std::vector<T, big_alloc<T>>;
66+
template<typename T>
67+
using big_basic_string = std::basic_string<T, std::char_traits<T>, big_alloc<T>>;
68+
using big_string = big_basic_string<char>;
6669
}
6770
#endif // CP_ALGO_UTIL_big_alloc_HPP

cp-algo/util/simd.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <memory>
77
#pragma GCC push_options
88
#pragma GCC target("avx2")
9-
109
namespace cp_algo {
1110
template<typename T, size_t len>
1211
using simd [[gnu::vector_size(len * sizeof(T))]] = T;

verify/poly/wildcard.test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#pragma GCC optimize("Ofast,unroll-loops")
44
#define CP_ALGO_CHECKPOINT
55
#pragma GCC target("avx2")
6+
#include <bits/stdc++.h>
67
#include "cp-algo/math/cvector.hpp"
78
#include "cp-algo/random/rng.hpp"
8-
#include <bits/stdc++.h>
99

1010
using namespace std;
1111
using namespace cp_algo::math;
@@ -27,7 +27,7 @@ auto is_integer(auto a) {
2727
return cp_algo::abs(a - cp_algo::round(a)) < eps;
2828
}
2929

30-
string matches(string const& A, string const& B, char wild = '*') {
30+
cp_algo::big_string matches(cp_algo::big_string const& A, cp_algo::big_string const& B, char wild = '*') {
3131
static ftype project[2][128];
3232
static bool init = false;
3333
if(!init) {
@@ -61,7 +61,7 @@ string matches(string const& A, string const& B, char wild = '*') {
6161
ranges::for_each(B | views::reverse | views::enumerate, assign(1));
6262
cp_algo::checkpoint("cvector fill");
6363
semicorr(P[0], P[1]);
64-
string ans(2 * size(P[0]), '0');
64+
cp_algo::big_string ans(2 * size(P[0]), '0');
6565
auto start = (ssize(B) - 1) / fft::flen * fft::flen;
6666
for(auto j = start; j < size(ans); j += fft::flen) {
6767
decltype(is_integer(real(P[0].at(j)))) check;
@@ -79,7 +79,7 @@ string matches(string const& A, string const& B, char wild = '*') {
7979
}
8080

8181
void solve() {
82-
string a, b;
82+
cp_algo::big_string a, b;
8383
cin >> a >> b;
8484
cp_algo::checkpoint("input");
8585
cout << matches(a, b) << "\n";

0 commit comments

Comments
 (0)