正文
增加 79 行删除 6 行
46 行未改动47484950515253545557 行未改动11311411511611711811912012142 行未改动16416516616716816917017117217317436 行未改动21121221321421521621721821922022116 行未改动23823924024146 行未改动{T dt; operator T&(){return dt;}tag(const T &v) {dt=v;} tag(){}const bool operator[](const int &xb) const {return ((dt >> xb) & 1);}void fz(const int &xb, const bool &v) //采用 a[1] = 0的方式需要8字节(一个指针),故不采用{if(v) dt |= (1 << xb);else dt &= ~(1 << xb);}57 行未改动```::::::info[矩阵]```cpp#define mod 998244353#define ilist initializer_listtemplate <class T> struct mat42 行未改动};```::::::info[线段树]```cpptemplate<unsigned char ce> struct dzpd{struct dzpd <ce-1> ls,rs;int l,r;int mini_ ;36 行未改动template <> struct dzpd <0>{int l,r;int mini_ ;void bd(cint bl, cint br) {l = bl, r = br; ;}void add(cint t1, cint t2, cint v) { ;}int ask(cint t1, cint t2){return [val];}}; struct dzpd <> t;```:::16 行未改动template <typename T> ptr<T> to_ptr(T* rptr) noexcept{ return (ptr<T>){(int)(rptr - ptr<T>::hp)}; }```:::46 行未改动47484950515253545557 行未改动11311411511611711811912012112242 行未改动16516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222336 行未改动26026126226326426526626726826927016 行未改动28728828929029129229329429529629729829930030130230330430530630730830931031131231331446 行未改动{T dt; operator T&(){return dt;}tag(const T &v) {dt=v;} tag(){}const bool operator[](const int &xb) const {return ((dt >> xb) & 1);}void fz(int xb, bool v) //采用 a[1] = 0的方式需要8字节(一个指针),故不采用{if(v) dt |= (1 << xb);else dt &= ~(1 << xb);}57 行未改动```:::::::info[矩阵]:::info[动态普通矩阵]```cpp#define mod 998244353#define ilist initializer_listtemplate <class T> struct mat42 行未改动};```::::::info[静态方阵]```cpp#define mod 998244353template <typename T, int N> struct mat{T dt[N][N];const T* operator[](int i) const {return dt[i];}T* operator[](int i) {return dt[i];}#define cmat const mat<T,N>&mat(){memset(this,0,sizeof(*this));}mat(initializer_list<initializer_list<T>> l){for (auto i = l.begin(); i != l.end(); ++i)for (auto j = i->begin(); j != i->end(); ++j)dt[i-l.begin()][j-i->begin()] = *j;}friend mat <T,N> operator * (cmat a, cmat b){struct mat <T,N> rt; int i,j,k;for (i = 0; i < N; i++)for (j = 0; j < N; j++){for (k = 0; k < N; k++)rt[i][j] += a[i][k] * b[k][j]; rt[i][j] %= mod;}return rt;}friend mat <T,N>& operator *= (mat<T,N>& a, cmat b) {return a = a * b;}friend mat <T,N>& operator += (mat<T,N>& a, cmat b){for (int i = 0; i < N; i++)for (int j = 0; j < N; j++)if((a[i][j] += b[i][j]) >= mod)a[i][j] -= mod; return a;}friend mat <T,N> operator + (mat a, cmat b) {return (a += b);}friend bool operator == (cmat a, cmat b){for (i = 0; i < N; i++)for (j = 0; j < N; j++)if (a[i][j] != b[i][j]) return 0; return 1;}};```::::::::::info[线段树]```cpptemplate <unsigned char ce> struct dzpd{struct dzpd <ce-1> ls,rs;int l,r;int mini_ ;36 行未改动template <> struct dzpd <0>{int l,r;int mini_ ;void bd(int bl, int br) {l = bl, r = br; ;}void add(int t1, int t2, int v) { ;}int ask(int t1, int t2){return [val];}}; struct dzpd <> t;```:::16 行未改动template <typename T> ptr<T> to_ptr(T* rptr) noexcept{ return (ptr<T>){(int)(rptr - ptr<T>::hp)}; }```::::::info[数组离散化]```cppvoid lsh_s(int* s, int* t){vector<int> a; a.insert(a.end(),s,t);sort(a.begin(),a.end()); a.erase(unique(a.begin(),a.end()),a.end());for_each(s,t,[&a](int& x){x = lower_bound(a.begin(),a.end(),x) - a.begin() + 1;});}```::::::info[mint]```cpp#define mod 10007template <typename T> T&& mint(T&& x){if (x >= mod) x -= mod;return forward<T>(x);}template <typename T> T&& Mint(T&& x){return forward<T>(x %= mod);}```:::