File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 55#include < iostream>
66#include < vector>
77#include < string>
8- #include " ../util/bump_alloc.hpp"
98namespace cp_algo ::structures {
109 template <int sigma = 26 , char mch = ' a' >
1110 struct eertree {
@@ -63,7 +62,7 @@ namespace cp_algo::structures {
6362 print (std::identity{});
6463 }
6564 private:
66- std::vector<std::forward_list<int , bump_alloc< int > >> to;
65+ std::vector<std::forward_list<int >> to;
6766 std::vector<int > len, link, par;
6867 std::string s;
6968 int n = 1 , sz = 2 , last = 0 ;
Original file line number Diff line number Diff line change 11#ifndef CP_ALGO_UTIL_BUMP_ALLOC_HPP
22#define CP_ALGO_UTIL_BUMP_ALLOC_HPP
33#include < cstddef>
4+ #include " big_alloc.hpp"
45namespace cp_algo {
5- alignas (64 ) char buf[450 << 20 ];
6- size_t buf_ind = sizeof buf;
7- template <class T > struct bump_alloc {
6+ template <class T , size_t max_len>
7+ struct bump_alloc {
8+ static char * buf;
9+ static size_t buf_ind;
810 using value_type = T;
911 bump_alloc () = default ;
1012 template <class U > bump_alloc (const U&) {}
@@ -15,5 +17,9 @@ namespace cp_algo {
1517 }
1618 void deallocate (T*, size_t ) {}
1719 };
20+ template <class T , size_t max_len>
21+ char * bump_alloc<T, max_len>::buf = big_alloc<char >().allocate(max_len * sizeof (T));
22+ template <class T , size_t max_len>
23+ size_t bump_alloc<T, max_len>::buf_ind = max_len * sizeof (T);
1824}
1925#endif // CP_ALGO_UTIL_BUMP_ALLOC_HPP
Original file line number Diff line number Diff line change 66#include " blazingio/blazingio.min.hpp"
77#include " cp-algo/util/checkpoint.hpp"
88#include " cp-algo/util/simd.hpp"
9+ #include " cp-algo/util/bump_alloc.hpp"
910#include " cp-algo/math/common.hpp"
1011
1112using namespace std ;
@@ -14,13 +15,16 @@ using namespace cp_algo;
1415constexpr int mod = 998244353 ;
1516constexpr int imod = -math::inv2(mod);
1617
18+ template <int maxn = 100'000 >
1719vector<int > facts (vector<int > const & args) {
1820 constexpr int accum = 4 ;
1921 constexpr int simd_size = 8 ;
2022 constexpr int block = 1 << 18 ;
2123 constexpr int subblock = block / simd_size;
22- static basic_string<array<int , 2 >> odd_args_per_block[mod / subblock];
23- static basic_string<array<int , 2 >> reg_args_per_block[mod / subblock];
24+ using T = array<int , 2 >;
25+ using alloc = bump_alloc<T, 30 * maxn>;
26+ basic_string<T, char_traits<T>, alloc> odd_args_per_block[mod / subblock];
27+ basic_string<T, char_traits<T>, alloc> reg_args_per_block[mod / subblock];
2428 constexpr int limit_reg = mod / 64 ;
2529 int limit_odd = 0 ;
2630
You can’t perform that action at this time.
0 commit comments