[Exam reflection] mathematical topics Test 3: Discovery

Well. . . Cushions for a long time ah. . . But for me the league can get a rk1 almost impossible for the county, so it is still to be written in memory of the blog.

In fact, the exam has nothing to say, the results are not what the real stock of knowledge gained. . .

Just a great God who do not care to play table like a boring means, just by chance I caught it.

Discrimination happened that T1 and T3 are not large, nor do I T3 also blown up, just hit the table T2 lucky to find exactly T2 law is no law at all can not do it, it opened the points difference. . .

The exam was like God arranged for a comfort food, like chicken.

Consequently, even if you do not, just lucky enough to be rk1

It is actually quite clever, because just too decadent "color colored map" before the explanations know to re-allocation skills so get the second tranche of sub-section.

Because most people think that God is now doing the kind of big problem is a waste problem, and only a few decadent problem solution 2333 so I have gained

T2 table to play for an hour. . . I guess other people should not put such a large amount of time with it now. . . But no way ah I consequently will not be in addition to playing table how can I do ah?

So it took time to think about the great God who used to play table. . . Under a lot of speculation on just wrote one holding stabilize n = 10 points, seven the rest of the casual attitude wrote

I feel most recent rp should almost finished overdraft

T3 do well. First, do not read the question carefully, subject to a point value as a factor did not look, adjusting an hour sample. . .

Lagrange interpolation is not less then a sub-file violence, and the formula can be simplified very complicating the redundancy of elimination than others outside the plurality of n.

In fact, the Gaussian elimination is sufficient to get 30 + 5 minutes, but since the constant is too large too cumbersome expression card to be 15 + 5 minutes.

If the luck of these factors removed, it is rk9 ah. . .

But I have to say:

Hit the table is really cool!

Fucks really useful tips!

(Although I played so far the success rate table also about 30%, but that title only enter a title can still try the parameter)

 

T1:young

Title effect: n FIG point, right point $ [0,2 ^ m) $ the random, two sides of the right or exclusive. Minimum spanning tree and the right to seek all circumstances. $ Mod \ 258280327 = 2 \ times 3 ^ {17} + 1 $

For $ 30 \% $ data $ n \ times m \ le 16 $. For $ 50 \% $ data $ m \ le 4 $. For $ 100 \% $ data $ n \ le 50, m \ le 8 $.

This sub-section title can talk about.

$ 30 \% $ search.

The same point 50 $ \ $%, may be incorporated right point, point number regardless of the answer, then the tap weights to reorder the latter larger than the former strict filter, integer addition distribution, small number of states.

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define mod 258280327
 4 int C[55][55],f[55],n,m,ans,v[55],N=1,fa[55];
 5 int qp(int b,int t,int a=1){for(;t;t>>=1,b=1ll*b*b%mod)if(t&1)a=1ll*a*b%mod;return a;}
 6 struct Ed{int a,b,v;friend bool operator<(Ed x,Ed y){return x.v<y.v;}}E[1234];
 7 int find(int p){return fa[p]==p?p:fa[p]=find(fa[p]);}
 8 void sch(int al){
 9     if(al==N+1){
10         int ec=0,c=0; for(int i=1;i<=N;++i)fa[i]=i;
11         for(int i=1;i<=N;++i)for(int j=i+1;j<=N;++j)E[++ec]=(Ed){i,j,v[i]^v[j]};
12         sort(E+1,E+1+ec);
13         for(int i=1,A=0;A<n&&i<=ec;++i)if(find(E[i].a)!=find(E[i].b))fa[fa[E[i].a]]=fa[E[i].b],c+=E[i].v,A++;
14         ans=(ans+1ll*f[N]*c)%mod;
15         return;
16     }for(int j=v[al-1]+1;j<1<<m;++j)v[al]=j,sch(al+1);
17 }
18 int main(){
19     cin>>n>>m;v[0]=-1;
20     for(int i=0;i<=50;++i)C[i][0]=f[i]=1;
21     for(int i=1;i<=50;++i)for(int j=1;j<=n;++j)f[i]=f[i]*1ll*i%mod;
22     for(int i=1;i<=50;++i)for(int j=1;j<=i;++j)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
23     for(int i=1;i<=50;++i)for(int j=1;j<i;++j)f[i]=(f[i]-1ll*f[j]*C[i][j]%mod+mod)%mod;
24     for(;N<=n;++N)sch(1);
25     cout<<1ll*ans*qp(qp(2,n*m),mod-2)%mod<<endl;
26 }
View Code

$ 100 \% $, then that is a great God $ dp $. Provided $ f (n, m) $ point represents $ $ $ n-2 ^ m $ minimum spanning the right and the right of FIG.

$ G (s, t, m) $ denotes the size of each case $ s, t $ sets of two points, weights in the range of the minimum cost of $ 2 ^ m $ all cases when the two point sets manipulation and China Unicom.

$ p (s, t, m , k) $ denotes the bond between the two point sets Collage weight greater than or equal to $ k $ the number of programs . Note that the program is not the right number.

Presence of metastases $ g (s, t, m) = \ sum \ limits_ {i = 1} ^ {2 ^ m-1} p (s, t, m, i) $. This is more obviously.

Consider the transfer of $ f $. For the current n-$ $ $ m $ the first site, and we will follow this it is on a $ 1 or $ 0 $ $ divided into two groups.

This set is $ 0 $ a set of points for the $ s $. The rest is $ t $. We enumerate the $ s $.

If the $ s = 0 $ or $ t = 0 $ then in any case will not produce side even this bit to $ 1 $ price. Otherwise they would like Unicom consideration must be $ 2 ^ {m-1} $ a. Whether a few more low.

So long as the $ s, t $ exist it will produce $ 2 ^ {m-1} \ times (2 ^ {m-1}) ^ {n} = 2 ^ {(m-1) (n + 1)} $. That's the meaning behind the multiplication sign is that all point pick.

In this case we consider that a contribution over, we were to consider the internal $ s $, $ t $ internal and $ s, even between t $ edges.

It does not contribute to a former two is $ f (s, m-1) \ times 2 ^ {(m-1) (ni)} + f (t, m-1) \ times 2 ^ {(m-1 ) s} $. The latter contribution of the current bit is removed $ g (s, t, m-1) $.

In front of the power is multiplied by 2, because $ s, t $ two set points are calculated independently, and you want to count all cases, it is possible for each set will make $ t $ $ s $ set all contribute answer .

So the total transfer type is:

$f(n,m)=\sum\limits_{s=0}^{n} C_n^s(2^{(m-1)(n-i)}f(s,m-1)+ 2^{(m-1)s}f(t,m-1) + g(s,t,m-1) + [s \neq 0\&t \neq 0]\times 2^{(m-1)(n+1)} )$

Next on the left of the transfer of $ p $. Meaning roughly similar, but the program is the number.

Discuss the $ s $ $ t $ a This set is $ 0 and $ 1 $ $ points, and then based on this one is $ k $ 0 $ / $ 1 classification discussed.

Because you will even the smallest edge, so when $ (s0, t0) $ or $ (s1, t1) $ at the same time there is this one you must be $ 0 $.

So if $ k $ on this one is $ 1 $ necessarily mean there is only so $ (s0, t1) $ or $ (s1, t0) $. Recursive process, the answer is $ 2 \ times p (s, t, m-1, k \ xor \ (1 << m-1)) $

If $ k $ on this one is $ 0 $, then direct enumeration $ s0, t0 $ size, independently of each other on both sides of multiplying the number of programs, then multiply that by the number of combinations selected points.

Transfer point, but also consider the issue of recursive border.

For $ f $. When the points or the right to answer is $ 0 $ 0 $ $. $ G $ is the same reason.

But the $ p $ is not. $ P $ is a program number. If $ m = 0 $ then it represents this $ k = 0 $, since the high of $ 1 $ are eliminated, so the program contributed $ 1 $.

And consider if there is a set of points is $ 0 $ a. So in any case do not make even the side of China Unicom, the price is $ \ infty \ geq k $. Therefore, another point can be set optionally.

Recursive border clamping. Pruning is a plus, because the $ s, t set the order of $ point is irrelevant, guarantee $ s \ le t $. Coupled out of memory technology, found on the line.

Theoretical complexity $ O (n ^ 4m2 ^ m) $. However, the actual operating efficiency is very good. Not put the table can also play out.

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define mod 258280327
 4 unordered_map<int,int>f[55],g[55][55],p[55][55][9];
 5 int C[55][55],n,m,ans,N=1,pw[405];
 6 int qp(int b,int t,int a=1){for(;t;t>>=1,b=1ll*b*b%mod)if(t&1)a=1ll*a*b%mod;return a;}
 7 int mo(int x){return x>=mod?x-mod:x;}
 8 int P(int S,int T,int m,int k){
 9     if(S>T)S^=T^=S^=T; if(!m)return !k; if(!S)return pw[T*m];
10     if(p[S][T][m].find(k)!=p[S][T][m].end())return p[S][T][m][k];
11     int ans=0;
12     if(k&1<<m-1)return p[S][T][m][k]=mo(P(S,T,m-1,k^1<<m-1)<<1);
13     for(int s=0;s<=S;++s)for(int t=0;t<=T;++t)if((s+T-t)*(t+S-s))ans=(ans+1ll*P(s,t,m-1,k)*P(S-s,T-t,m-1,k)%mod*C[S][s]%mod*C[T][t])%mod;
14     return p[S][T][m][k]=mo(ans+pw[(S+T)*(m-1)+1]);
15 }
16 int G(int S,int T,int m){
17     if(S>T)S^=T^=S^=T; if(!m||!S)return 0;
18     if(g[S][T].find(m)!=g[S][T].end())return g[S][T][m];
19     int ans=0;
20     for(int k=1;k<1<<m;++k)ans=mo(ans+P(S,T,m,k));
21     return g[S][T][m]=ans;
22 }
23 int F(int n,int m){
24     if(!m||n<=1)return 0;
25     if(f[n].find(m)!=f[n].end())return f[n][m];
26     int ans=0;
27     for(int i=0;i<=n;++i)ans=(ans+(1ll*pw[(n-i)*(m-1)]*F(i,m-1)+1ll*pw[i*(m-1)]*F(n-i,m-1)+G(i,n-i,m-1)+(i&&i!=n?pw[(n+1)*(m-1)]:0))%mod*C[n][i])%mod;
28     return f[n][m]=ans;
29 }
30 int main(){
31     for(int i=0;i<=50;++i)C[i][0]=1;pw[0]=1;
32     for(int i=1;i<=50;++i)for(int j=1;j<=i;++j)C[i][j]=mo(C[i-1][j-1]+C[i-1][j]);
33     for(int i=1;i<=400;++i)pw[i]=mo(pw[i-1]<<1);
34     cin>>n>>m;cout<<1ll*qp(pw[n*m],mod-2)*F(n,m)%mod<<endl;
35 }
View Code

 

T2:simple

Title effect: For all with leading 0 of n bits $ X-$ if it satisfies any $ 1 \ le k <n, X \ times 10 ^ k \ mod \ 10 ^ n> X $, generated $ n ^ 2 $ . contribution. Seek all $ k le n $-digit contribution \.

For $ 10 \% $ data $ n = 7 $. For $ 100 \% $ data $ n = 10 ^ {10}, mod = 258280327 = 2 \ times 3 ^ {17} + 1 $.

For this read-only parameter into a subject can be considered to play table.

Correct answer is to consider the meaning of the expression, in fact, is left in decimal, for a number of cycles section is clearly not true, or else it for $ n $ digits maximum displacement cycle legitimate rest is not lawful.

So the answer is $ \ sum \ limits_ {i = 1} ^ {n} i ^ 2 \ sum \ limits_ {d | i} \ mu (\ frac {i} {d}) \ frac {10 ^ i} {d } $

Simplification, and then set a arithmetic to geometric, with discovery requests is $ i \ times \ mu (i) $ prefix and. Roll a $ id $ DU can teach sieve.

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define S 20000005
 4 #define mod 258280327 
 5 #define ll long long
 6 const int I9=229582513,I81=1ll*I9*I9%mod;
 7 unordered_map<int,int>Mu;
 8 int p[S],M,pc,mu[S];char np[S];ll n;
 9 int MU(ll x){int a=1;
10     if(x<M)return mu[x]; if(Mu.find(x)!=Mu.end())return Mu[x];
11     for(ll i=2,N,l;N=x/i,i<=x;i=l+1)l=x/N,a=(a-(l-i+1ll)%mod*(i+l)%mod*129140164%mod*MU(N)%mod+mod)%mod;
12     return Mu[x]=a;
13 }
14 int qp(ll b,ll t,int a=1){for(;t;t>>=1,b=1ll*b*b%mod)if(t&1)a=1ll*a*b%mod;return a;}
15 ll cal(ll n){ll P=qp(10,n+1);return ((n*P-10)%mod*I9%mod-(P-100)*I81%mod+mod)%mod;}
16 int main(){//freopen("1.in","r",stdin);
17     cin>>n;M=pow(n,0.72);mu[1]=1;
18     for(int i=2;i<M;++i){
19         if(!np[i])mu[p[++pc]=i]=-i;
20         for(int j=1,x;j<=pc&&(x=p[j]*i)<M;++j)
21             if(i%p[j])np[x]=1,mu[x]=-mu[i]*p[j];
22             else {np[x]=1;break;}
23     }int a=0;
24     for(int i=2;i<M;++i)mu[i]=(mu[i-1]+mu[i]+0ll+mod)%mod;
25     for(ll i=1,N,l,cl=0,cn;N=n/i,i<=n;i=l+1)l=n/N,cn=cal(l),a=(a+1ll*(cn-cl+mod)%mod*MU(N))%mod,cl=cn;
26     cout<<a<<endl;
27 }
View Code

 

T3: H little love stain (Loj2504)

Title effect: No $ [0, n) $ may be heavily ball twice picked from $ m $ Staining. Seeking a desired $ F (A) $ under all scenarios. $ A $ is colored balls represent the lowest number.

For given $ 0 \ le i \ le m $ a $ F (i) $ value. You may think that $ F $ is not greater than $ m $ polynomials of degree.

For $ 100 \% $ data, $ n \ le mod = 998244353, m \ le 10 ^ 6 $

It is said that serious card often. Looked very expression of violence. Internet direct search solution to a problem. Back to fill the empty pit.

Guess you like

Origin www.cnblogs.com/hzoi-DeepinC/p/12169550.html