正文
增加 1 行删除 175 行
306 行未改动全部展开307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352116 行未改动全部展开469470471472473474475476477478479480481482483484485486487488489490491492493494495496150 行未改动全部展开647648649650651652653654655656657658659660661662663664665666667668669670671672673674228 行未改动全部展开903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932516 行未改动全部展开1449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485194 行未改动全部展开168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171612 行未改动1729173017311732173317341735173617374 行未改动1742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177988 行未改动306 行未改动全部展开时间复杂度 $O(n^3 \log m)$。```cpp#include<iostream>#include<cstdio>#include<cmath>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int N = 602,MOD = 998244353 ;int n,m,r = 1 ;int p[N] ;bool has_p[N] ;ll a[N][N],ans[N],cnt = 1 ;inline ll exgcd (ll a,ll b,ll &x,ll &y) {if (!b) {x = 1,y = 0 ;return a ;}re ll g = exgcd(b,a % b,y,x) ;y -= a / b * x ;return g ;}inline void gauss () {for (re int i = 1 ; i <= n ; ++i) {int mx = r ;for (re int k = r ; k <= n ; ++k) {116 行未改动全部展开时间复杂度 $O(n^3)$。```cpp#include<iostream>#include<cstdio>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int P = 1e9 + 7,N = 402 ;int n,p[N],r = 1 ;ll a[N][N << 1] ;inline ll qpow (ll a,ll b) {150 行未改动全部展开代码:```cpp#include<iostream>#include<cstdio>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int N = 602 ;int n,m,r = 1 ;ll a[N][N],ans = 1 ;bool f ;228 行未改动全部展开求出第 $n$ 行后需要看第 $n$ 行(前面相邻两行会相互制约,但第 $n$ 行没有第 $n+1$ 行进行扭转纠正)最终颜色是否全 $0$,合法就统计 $x_{i,j} = 1$ 的数量。统计最小值。```cpp#include<iostream>#include<cstdio>#include<bitset>#include<cstring>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int N = 18 ;int T,n ;int p[N * N],minn = 1e9 ;bool col[N][N],x[N * N] ;516 行未改动全部展开也就是说高消的时候去归一某一行,$ans'$ 乘的是某个数而非这个数的**逆元**(当然这是仅当模数是质数时才能用逆元直接算)。```cpp/*_/ _/ _/_/_/_/_/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/_/_/_/_/_/ _/ _/ _/ _/*/#include<iostream>#include<cstdio>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int P = 1e9 + 7,N = 305 ;int n,m,t ;ll A[N][N],D[N][N] ;#define mod(x) ((((x) %= P) += P) %= P)194 行未改动全部展开注意对 $p$ 取模。```cpp/*_/ _/ _/_/_/_/_/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/_/_/_/_/_/ _/ _/ _/ _/*/#include<iostream>#include<cstdio>#define re register#define endl '\n'#define ll __int128#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;ll n,m,p ;inline ll qpow (ll a,ll b) {ll ans = 1 ;while (b) {12 行未改动## [6. MarsOJ P2649. Expectation](https://marsoj.cn/p/P2649)定义生成树的“权值”为所有边权的按位与。求随即一颗生成树权值期望。### 思路首先总情况数即总生成树个数 $sum$。4 行未改动期望 $p = \sum\limits_{i=1}^{base}\dfrac{now_i}{sum}\times 2^i$。```cpp/*_/ _/ _/_/_/_/_/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/_/_/_/_/_/ _/ _/ _/ _/*/#include<iostream>#include<cstdio>#include<cstring>#define re register#define endl '\n'#define ll long long#define ull unsigned long long#define db double#define fi const int&#define fl const ll&#define ful const ull&#define fc const char&#define fs const string&#define debug() puts("I Love Hina Forever")using namespace std ;namespace IO {template<class T>inline void read(T &x){char c=getchar(),f=false;x=0;while(c<48||c>57) {f|=(c==45),c=getchar();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+(c^48),c=getchar();}if(f){x=~x+1;}}template<class T,class ...Arg>inline void read(T &x,Arg &...arg){read(x),read(arg...);}template<class T>inline void write(T x){if(x<0){putchar(45),x=~x+1;}if(x>9){write(x/10);}putchar(x%10|48);}template<class T>inline void write(T x,fc c){write(x),putchar(c);}}using namespace IO ;const int N = 102,P = 998244353 ;int T,n,m ;ll K[N][N],sum,ans ;struct node {88 行未改动306 行未改动全部展开307308309310311312313314315316317318319320321322323324325326327328116 行未改动全部展开445446447448449450451452150 行未改动全部展开603604605606607608609610228 行未改动全部展开839840841842843844845846516 行未改动全部展开13631364136513661367136813691370194 行未改动全部展开1565156615671568156915701571157212 行未改动1585158615871588158915901591159215934 行未改动1598159916001601160216031604160588 行未改动306 行未改动全部展开时间复杂度 $O(n^3 \log m)$。```cppconst int N = 602,MOD = 998244353 ;int n,m,r = 1 ;int p[N] ;bool has_p[N] ;ll a[N][N],ans[N],cnt = 1 ;inline ll exgcd (ll a,ll b,ll &x,ll &y) {if (!b) {x = 1,y = 0 ;return a ;}re ll g = exgcd(b,a % b,y,x) ;y -= a / b * x ;return g ;}inline void gauss () {for (re int i = 1 ; i <= n ; ++i) {int mx = r ;for (re int k = r ; k <= n ; ++k) {116 行未改动全部展开时间复杂度 $O(n^3)$。```cppconst int P = 1e9 + 7,N = 402 ;int n,p[N],r = 1 ;ll a[N][N << 1] ;inline ll qpow (ll a,ll b) {150 行未改动全部展开代码:```cppconst int N = 602 ;int n,m,r = 1 ;ll a[N][N],ans = 1 ;bool f ;228 行未改动全部展开求出第 $n$ 行后需要看第 $n$ 行(前面相邻两行会相互制约,但第 $n$ 行没有第 $n+1$ 行进行扭转纠正)最终颜色是否全 $0$,合法就统计 $x_{i,j} = 1$ 的数量。统计最小值。```cppconst int N = 18 ;int T,n ;int p[N * N],minn = 1e9 ;bool col[N][N],x[N * N] ;516 行未改动全部展开也就是说高消的时候去归一某一行,$ans'$ 乘的是某个数而非这个数的**逆元**(当然这是仅当模数是质数时才能用逆元直接算)。```cppconst int P = 1e9 + 7,N = 305 ;int n,m,t ;ll A[N][N],D[N][N] ;#define mod(x) ((((x) %= P) += P) %= P)194 行未改动全部展开注意对 $p$ 取模。```cppll n,m,p ;inline ll qpow (ll a,ll b) {ll ans = 1 ;while (b) {12 行未改动## [6. MarsOJ P2649. Expectation](https://marsoj.cn/p/P2649)定义生成树的“权值”为所有边权的按位与。求随机一颗生成树权值期望。### 思路首先总情况数即总生成树个数 $sum$。4 行未改动期望 $p = \sum\limits_{i=1}^{base}\dfrac{now_i}{sum}\times 2^i$。```cppconst int N = 102,P = 998244353 ;int T,n,m ;ll K[N][N],sum,ans ;struct node {88 行未改动