版本比较
模板
正文
增加 24 行删除 0 行
360 行未改动全部展开361362363364360 行未改动全部展开bool operator==(ll b)const{bignum tmp;tmp=b;return *this==tmp;}bool operator!=(ll b)const{bignum tmp;tmp=b;return *this!=tmp;}};```360 行未改动全部展开361362363364365366367368369370371372373374375376377378379380381382383384385386387388360 行未改动全部展开bool operator==(ll b)const{bignum tmp;tmp=b;return *this==tmp;}bool operator!=(ll b)const{bignum tmp;tmp=b;return *this!=tmp;}};```# 哈希```cppconstexpr ll base1=233,base2=131,mod1=998244353,mod2=1e9+7;struct hash{ll n;string s;vector<ll> pw1,pw2,h1,h2;inline void init(){n=s.size();s=" "+s;pw1.resize(n+1,0);pw2.resize(n+1,0);h1.resize(n+1,0);h2.resize(n+1,0);pw1[0]=pw2[0]=1;for(int i=1;i<=n;i++) pw1[i]=pw1[i-1]*base1%mod1,pw2[i]=pw2[i-1]*base2%mod2;for(int i=1;i<=n;i++){h1[i]=(h1[i-1]*base1+s[i])%mod1;h2[i]=(h2[i-1]*base2+s[i])%mod2;}}inline pll gethash(int l,int r){return {(h1[r]-h1[l-1]*pw1[r-l+1]%mod1+mod1)%mod1,(h2[r]-h2[l-1]*pw2[r-l+1]%mod2+mod2)%mod2};}};```