nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 广义斐波那契数递推公式$$f_i=af_{i-1}+bf_{i-2}(\mod p) (p是奇素数)$$ 他的转移矩阵$$ \left[ \begin{matrix} a & b \ 1 & 0 \end{matrix} \right]^n \left[ \begin{matrix}...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###namethe power of Fibonacci ###descriptionAmy asks Mr. B problem A. Please help Mr. B to solve the following problem.Let Fi be fibonacci number.$F_0 = 0, F_1 = 1, F_i =...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 1234567891011121314#define I __int128void exgcd(I a,I&x,I b,I&y,I c){ // assert(__gcd(a,b)==c) if(b==0) x=c/a,y=0; else exgcd(b,y,a%b,x,c),y-=a/b*x;}inline bool merge(I...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 虚树就是把树上一些节点拿下来重新建树,插入一些lca之类的点,deltree会删除一颗树,但不会删掉他的边,所以要注意边的情况 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556// tree 节点0不准使用const int...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 1234567891011121314151617181920212223242526272829typedef long long ll;struct cp{ static ll p,w; ll x,y;// x+y\sqrt(w) cp(ll x,ll y):x(x),y(y){} cp operator*(cp...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 1234567891011//究极读入挂inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;}inline int...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 12345678910111213141516171819202122232425262728293031323334353637383940int top,c[N][2],f[N],tim[N],sta[N],rev[N],val[N];void ini(){ for(int...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###nameexplorer ###descriptionGromah and LZR have entered the fifth level. Unlike the first four levels, they should do some moves in this level. There are nvertices and m bidirectional roads in this...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 123456789101112131415161718192021222324252627282930313233343536const int maxn=1e5+5;int to[maxn<<1],nex[maxn<<1],head[maxn],w[maxn],cnt;void ini(){cnt=-1;for(int...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 霍尔定理推论: 对于一个二分图G<V,E>,若点可以分为两部分N和M,N内部没有边,M同理,S’是N的某个子集(可以为空),f(S’)是与该子集相邻的点集,则他的最大匹配为|N|-max(|S’|-|f(S’)|),