From 5d053b957fe69d761e3ae89d75081ad53208a69f Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Wed, 1 May 2024 00:07:53 +0200 Subject: [PATCH] define custom maxn via CP_ALGO_MAXN --- cp-algo/algebra/common.hpp | 4 ++++ verify/algebra/matrix/characteristic.test.cpp | 1 + verify/algebra/matrix/pow_fast.test.cpp | 1 + 3 files changed, 6 insertions(+) diff --git a/cp-algo/algebra/common.hpp b/cp-algo/algebra/common.hpp index 6498593..53f6099 100644 --- a/cp-algo/algebra/common.hpp +++ b/cp-algo/algebra/common.hpp @@ -3,7 +3,11 @@ #include #include namespace cp_algo::algebra { +#ifdef CP_ALGO_MAXN + const int maxn = CP_ALGO_MAXN; +#else const int maxn = 1 << 20; +#endif const int magic = 250; // threshold for sizes to run the naive algo auto bpow(auto const& x, int64_t n, auto const& one, auto op) { diff --git a/verify/algebra/matrix/characteristic.test.cpp b/verify/algebra/matrix/characteristic.test.cpp index 21fc020..bf6e5e5 100644 --- a/verify/algebra/matrix/characteristic.test.cpp +++ b/verify/algebra/matrix/characteristic.test.cpp @@ -2,6 +2,7 @@ #define PROBLEM "https://judge.yosupo.jp/problem/characteristic_polynomial" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") +#define CP_ALGO_MAXN 1 << 12 #include "cp-algo/linalg/frobenius.hpp" #include diff --git a/verify/algebra/matrix/pow_fast.test.cpp b/verify/algebra/matrix/pow_fast.test.cpp index 5d14f34..70eae0e 100644 --- a/verify/algebra/matrix/pow_fast.test.cpp +++ b/verify/algebra/matrix/pow_fast.test.cpp @@ -2,6 +2,7 @@ #define PROBLEM "https://judge.yosupo.jp/problem/pow_of_matrix" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") +#define CP_ALGO_MAXN 1 << 12 #include "cp-algo/linalg/frobenius.hpp" #include