春季赛模拟2

A.魔法

部分分\(R=1,B=1\)的一种做法是括号匹配,这提示了正解。
做法就是用类似单调栈的方法,逐次进栈,栈顶恰好可消即消,最后倒序输出操作即可

点击查看代码


#include <bits/stdc++.h>
typedef long long ll;typedef unsigned long long ull; typedef double db;typedef long double ldb;
#define fre(x) freopen(#x ".in","r",stdin),freopen(#x ".out","w",stdout)
#define Rep(i,a,b) for(int i=a;i<=b;++i) 
#define Dwn(i,a,b) for(int i=a;i>=b;--i)
#define pii pair<int,int>
#define mair make_pair
#define fir first
#define sec second
using namespace std;

const int maxn=2e5+10;

int st[maxn];
int n,R,B,Len;
char s[maxn];
int cnt[2];
vector<int>Ans[maxn];
int tot,top;

void Pop(){
	++tot;
	Rep(i,1,Len){ Ans[tot].emplace_back(st[top]); --top; }
	cnt[0]=cnt[1]=0;
	Rep(i,max(1,top-Len+2),top)++cnt[(s[st[i]]=='B' ? 1 : 0)];
}

void solve(){
	cin>>n>>R>>B;cin>>(s+1);
	Len=R+B;top=Len-1;
	Rep(i,1,Len-1)st[i]=i,++cnt[(s[i]=='B' ? 1 : 0)];
	Rep(i,Len,n){
		st[++top]=i;++cnt[(s[i]=='B' ? 1 : 0)];
		if(top>=Len){
			if(cnt[0]==R && cnt[1]==B)Pop();
			else --cnt[(s[st[top-Len+1]]=='B' ? 1 : 0)];
		}
	}
	if(!top){
		cout<<"YES\n";
		cout<<tot<<"\n";
		Dwn(i,tot,1){
			for(auto it : Ans[i])cout<<it<<" ";
			cout<<"\n";
		}
	}else cout<<"NO\n";
}

int main (){ fre(magic);ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);return solve(),0; }

B.连通性

直接粘了,题解挺清楚了。

image
image

点击查看代码


#include <bits/stdc++.h>
typedef long long ll;typedef unsigned long long ull; typedef double db;typedef long double ldb;
#define fre(x) freopen(#x ".in","r",stdin),freopen(#x ".out","w",stdout)
#define Rep(i,a,b) for(int i=a;i<=b;++i) 
#define Dwn(i,a,b) for(int i=a;i>=b;--i)
#define pii pair<int,int>
#define mair make_pair
#define fir first
#define sec second
using namespace std;

const int maxn=1e2+10,Mod=1e9+7;

int pw(int x,int p){int res=1,base=x;while(p){if(p&1)res=1LL*res*base%Mod;base=1LL*base*base%Mod;p>>=1;}return res;}
int Inv(int x){return pw(x,Mod-2);}

int n,m;
int C[maxn][maxn],E[maxn][maxn];
int f[maxn][maxn],g[maxn],h[maxn][maxn];

void InitC(const int n=1e2){ C[0][0]=1; Rep(i,1,n){ C[i][0]=1;Rep(j,1,i)C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod; } }
void InitE(const int n=1e2){ E[0][0]=1; Rep(i,1,n){ E[i][0]=1;Rep(j,1,i)E[i][j]=(E[i-1][j]+E[i-1][j-1])%(Mod-1); } }
/*
void solve(){
	n=100;
	Rep(i,1,n){
		Rep(j,1,i-1)g[i]=(g[i]-1LL*g[j]*pw(2,E[i-j][2])%Mod*C[i-1][j-1])%Mod;
		g[i]=(g[i]+pw(2,E[i][2]))%Mod;
	}
	Rep(i,1,n)Rep(j,1,n)h[i][j]=1LL*g[i]*pw(pw(2,i)-1,j)%Mod*pw(2,E[j][2])%Mod;
	f[0][0]=1;
	Rep(i,1,n){
		f[i][0]=pw(2,E[i][2]);
		Rep(j,1,i){
			Rep(k,1,j)f[i][j]=(f[i][j]+1LL*f[i-k][j-k]*C[j-1][k-1])%Mod;
			Rep(k,1,j)Rep(l,1,i-j)
				f[i][j]=(f[i][j]+1LL*f[i-k-l][j-k]*C[j-1][k-1]%Mod*C[i-j][l]%Mod*h[l][k])%Mod;
		}
	}
	Rep(i,1,n){
		cout<<"{ ";
		Rep(j,0,100)cout<<(f[i][j]%Mod+Mod)%Mod<<",";
		cout<<" },"<<"\n";
	}
}
*/
int ans[101][101]={
	{},
	{ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 8,7,6,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 64,51,38,25,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 1024,814,584,356,155,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 32768,27562,20950,13674,6794,1731,203,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 2097152,1881132,1559050,1143026,688940,285399,42597,877,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 268435456,252352192,225134416,183912440,130448704,73134373,25675622,2389418,4140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 719476260,437453186,285852834,198930901,417447372,493700668,936095345,770727467,287447420,21147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 371842544,598590656,444061297,956708189,127125386,834823998,128227000,223478915,929725695,302765502,115975,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 766762396,413139421,351102112,112130130,188617941,339825372,543187105,114675694,623357729,261270827,104995134,678570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 329376018,705367106,201640714,352379330,550132198,846985547,818860561,624544091,494980544,959053918,443889176,751093169,4213597,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 124160285,828328425,906083967,147213859,527558165,193958029,794519533,742501375,789123747,444469745,993581787,979243161,593627163,27644437,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 121047601,912065930,1351624,402906644,713933492,50841084,863660427,577705270,887029586,145474376,588251882,706568129,777275244,642664828,190899322,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 243880903,599607852,442677191,436289683,281113930,146582434,584824855,564630340,394164220,378918082,150572902,532909740,763622255,37460367,184612284,382958538,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 489373567,413411086,951426968,887302037,155903135,283219023,620782126,905791112,644465700,989656495,523232248,664652865,948982217,20783496,743914774,684000569,480142077,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 585862415,487913812,590859253,163506170,675080686,265650536,163485583,426697524,541587646,670844388,797779476,563923072,432598176,907835837,738939538,774082037,950670428,864869230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 157921350,585213032,124127002,444551557,903311742,164413448,386967031,407995046,262661729,344515452,135908010,878209413,368549114,629205902,255793356,578014821,143082468,257436696,76801385,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 134084614,402761743,842286714,498687688,314252511,433353429,874023832,163451857,900776051,750447840,374976568,374596374,409363634,1428564,912190395,954400021,334527550,458752164,941524580,742164233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 953612746,62713484,886653018,688345870,697128468,646792556,447421618,157888096,21488155,259486619,668079888,781355645,145564249,348149153,451544648,902288907,821364589,27915451,532351829,752058720,157873304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 431750151,79333107,758273946,860328871,840463615,976556515,146605392,618220382,698863882,145835594,427902538,38761432,701961998,464958606,869153221,553709997,280018488,290250685,77551688,344667085,416460692,812832668,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 686331837,758771584,485081276,510183332,730280308,184674456,873283293,908734440,930495524,921797799,212061161,804809207,51215048,121939666,630812700,361452271,26060826,260673621,368617358,224024063,925630581,990272358,706900318,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 349105660,25145415,494217168,424339281,884124084,178064091,100120309,586769841,537648583,716807985,873050578,284978094,16767349,478326338,360734130,365771597,696838864,978081529,737982499,875617822,24227796,132241837,339570145,546020311,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 511821710,985509751,578878282,683372471,984664469,445595417,511225116,297223834,226459528,50743021,379480638,49592809,80759195,105089674,771654463,22227793,380679886,708398028,50944040,764421492,498261079,315274861,591041992,688069697,173093227,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 322050759,980010103,195981374,266943379,862920298,642981702,565788131,461650931,496112002,294720715,83658304,655891864,436544737,505904269,704369108,690578043,984206794,499813591,893187636,280796490,263963693,225773893,329099972,884281955,830106734,759867260,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 217770278,196781219,890030133,37157328,506726851,398596965,659090154,164461980,171196138,432900123,414177648,969005208,772702391,49944042,455929710,137419373,943545017,914493864,182760987,365740932,575380536,268772977,476434619,384262114,433073632,612700665,200033042,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 867243987,419317505,924705238,470690638,785733630,636069944,47184988,429517972,327113655,171088007,730658644,759695884,877945767,126877050,375168331,29949383,354344303,715402345,643780779,235404899,96456467,947306130,165323631,839427048,757122949,315330535,577080497,40680577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 742004924,254372018,291387829,267349513,54024762,671245107,613585423,508809588,231811039,104767602,167910887,114090978,909920550,592620873,356390422,542638360,87578277,455438768,894088070,835976016,969566965,323042316,212287755,517833930,442679595,261582652,823187406,532793112,159122123,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 733922348,167366410,876753742,975422598,799075476,725829008,872365212,85018489,340486853,193566452,599261528,908283866,800187671,74553339,199864122,531353232,700507329,796422638,830761055,904523627,962290437,384793789,30417305,755042000,79331844,560314134,348742603,131981681,16038223,665114805,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 549790477,671810211,129382453,966885251,350592706,596447982,138443086,691404995,414285379,196630498,881923189,163813881,256102447,71583160,508771819,681877733,69375609,207682964,724982026,837267786,668534167,138984993,187812264,924844266,260256369,841319659,600930379,54790790,377702315,626113287,272358185,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 459478873,948673060,879976129,77561086,165638941,509558379,837667237,103572912,894613159,206725937,182772554,998752430,47107053,551788393,894748127,994170493,465274175,508504228,270177642,700062682,628387180,156798153,73871430,830714579,260430563,237342573,723016796,489063843,736112179,110309822,473238523,365885605,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 461905191,192165619,747770106,332106409,398047884,542104469,197965617,370342165,11068589,679254174,758866370,857614267,645140882,582386803,555714996,329617223,461427609,814724809,139913691,279486796,254687615,584423075,179009767,310504013,840539020,479836189,75959175,376095868,716191358,285404140,70446126,201071854,744733441,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 310559811,692706359,114952121,589789,197188321,269080294,498208881,629662567,792354713,176304605,906976244,468957371,531603707,897184676,634643342,637325685,847138825,474895813,788073860,313965361,648791064,944711077,865937497,622472778,554274047,626418740,890567626,794263440,514221087,940409196,568590746,975780789,625062413,692873095,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 720063004,514071464,720590190,562298898,707467805,921118994,71916204,326117125,12744339,104010564,446163721,80786738,594937065,670679635,989080689,743456611,91741554,850963073,209030382,204167494,514300043,535977901,567903595,891459400,1565124,678215773,565094050,874198356,542097582,397868812,971072020,684763494,952651896,792935414,463056339,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 363951854,533712601,613612726,684833825,885522596,994755404,453084167,5686560,592060426,85188289,163163883,674500816,814709411,789909019,747209202,824975930,473236787,251853539,248980472,95331397,320829588,356098043,499982795,101569832,562105659,298126246,59540251,253450577,570972450,124186958,108579178,388935692,360714078,70717936,995618862,828412002,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 451501514,455863211,667442151,284857856,806818775,62989212,127942382,918256345,689813991,817037279,437212397,820083716,300971768,334012433,359525351,414736829,395405546,291553822,251302231,81336112,449119645,251626769,304104924,522072698,990312351,425178419,853656164,166017455,548825829,503846746,382171396,902545004,383608736,961132395,412843390,201489221,817756178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 403145314,302594789,119692152,801838972,309188256,640374867,930604812,463548456,859729712,616220450,846353372,790484235,770481033,897914912,418395599,934106855,957114976,213017240,878174936,526015728,285827022,851307532,45488497,506764881,657262624,482384244,624191146,41042634,930861500,523282256,862176302,591206152,445143145,98232994,337753801,580039286,394539625,366396447,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 445742553,920930190,618467072,830108606,410129292,103013150,526699502,662467377,289154902,783869201,833704838,234742715,121466416,978991222,675108227,82848558,396027899,704774559,233265149,548109093,761809919,482936390,702193112,938839019,52955263,568236345,660308411,58801676,358901394,851410000,924676245,895214879,7409527,795655953,362762125,193892235,408309456,631325110,683685664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 841534010,556349152,636110463,104393421,316124540,555447825,808092758,695139212,32056979,391521851,915375601,764002301,453079523,698106226,292515850,985598119,335638237,554668887,459958304,519173438,345239465,145649238,742075755,492752594,475707840,615454592,892620658,367245832,392562692,915668045,572448455,433406225,758826887,29418592,885677275,265999684,23245001,158111789,83834338,681586780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 514851479,790445500,580811065,226784910,395103645,70630538,126702244,988666831,297547678,755002235,429217769,337085154,781063342,975089165,56075509,201434726,422033180,342049785,388335656,433478739,126972685,984076482,364134870,216052286,341802953,462011635,396243269,523154481,450523207,199666167,630116440,369410996,349080051,866483443,707394221,225181557,660624393,828140730,435450553,864043371,840750853,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 574794279,780298930,717498605,457416440,999243964,81444157,824289854,340261948,861008986,289969281,35405344,915472694,727987225,505049953,674922372,589155591,796938240,849815851,701763196,814508375,659421166,330936448,247521497,772281187,30213422,682804165,779868190,269685870,361955653,110185220,65747688,890550949,284167942,302471994,736103035,810853021,316189417,666665569,858354115,172541785,766342407,683889724,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 342742191,801813240,451837162,964284972,666065915,248317835,35476411,934310259,789581466,287955184,661427574,924788023,756605552,351632653,50196887,104853216,627727442,979789795,270911774,871335913,647733415,377034208,148700028,534632457,788327101,989648678,898176729,226474996,960591003,31201113,708415457,312120961,417772228,403066267,876310201,528791084,201744011,887306815,225149667,373766019,626039819,3425893,216039853,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 918181383,485535359,303177672,719707445,591780285,134245958,218522202,315813172,700752839,548272540,437620754,917968266,979687501,614976599,959939269,6631993,20646513,584270185,815764999,797243417,554339252,586373964,593288105,704544473,563849774,389637723,36809926,556999167,715830709,176283904,85285627,973763671,42299689,894144161,331356191,279329764,807180946,227890939,581038881,253992517,912855384,908072663,733728244,954226396,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 729556520,649630450,909829173,156554452,823452341,129416469,698721976,540353255,355902305,332778653,804768637,146406952,10106877,835278272,551614260,601523379,941589971,943425007,96461206,969131497,694931015,305092242,432193773,449095750,180776628,923500261,873161043,57375992,255281551,174975664,635375937,426676640,314553745,994609240,187767806,65499253,527395169,655802119,964339998,873570362,236228239,607173609,992410823,254974603,858087702,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 244812915,938931203,681133687,901223827,608571348,787184552,717686918,377000300,186799300,681525108,740598635,37048369,492943490,334366799,199143729,474993845,658001089,556180984,542902187,452759254,714035318,498885606,236848543,435787456,852612916,857227247,35555045,698630692,614405567,221973246,57495261,545637525,207436728,940697619,980600009,236658538,942457345,473300474,736140300,910731313,663507692,611666819,716777013,231711677,941017541,540284076,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 480432768,545206003,274489230,888008154,40016066,286928972,238248176,895449176,412768093,792910405,874666753,965359532,967728067,24886601,940823039,236054152,500750413,25397091,461999638,434555123,287413486,98386808,623604775,18033343,846491635,912669600,787437173,975508943,426723587,759444260,796695213,160749914,11907755,73188549,567676337,30884957,499921643,134258019,631738486,882693811,778206365,299760079,594217913,978568397,440410986,534649902,514254014,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 847128810,212389525,701125998,878805956,115467622,74755813,100644985,530421200,182735886,614925233,67333991,799685484,567460175,615115005,139139456,620109355,403304959,330113757,626045136,733425560,50269669,336179821,647216785,669852199,334540102,745975904,714496935,513825878,626746162,520059267,521330495,854923299,222036870,183204082,543557199,94720918,960388135,106094531,746463768,958544561,282013067,784592361,461090063,389098502,617861627,525489702,703863826,647209774,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 404411734,728831000,895960345,171639292,4098612,164413669,43613252,641923519,440294586,620902939,310001661,201402176,603515327,906750839,585087174,246651304,274236792,388068862,769008901,113416358,442080910,941669620,609332642,774190365,949899374,546017909,458137232,883253904,658406874,805180048,890491819,63398634,807608514,222659727,394529753,255999445,807370194,942520995,899082442,584860525,919337909,152026270,340145783,919995375,101170347,670726107,786221920,663152489,900185117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 530951103,320231646,171461192,366194650,539280267,504756026,75657390,807857553,204518178,130503978,116515680,747413429,80971414,384948985,611517293,200525391,294768673,1189058,949466871,907630916,167410801,272715777,171390713,224092672,212315849,509317518,108431119,829257018,86840730,678768073,874259830,502172134,688129860,214134655,506914172,171381415,599297269,566555238,5146156,711710883,238462641,478929291,813577858,290416284,513228366,357361210,403220045,263206858,745787657,348985796,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 953833279,146403010,968776570,455031343,220517136,140249895,346732359,332889981,89935741,873633645,15800166,347202277,914786180,528825537,966225620,514843928,780718526,641940303,395603325,845486768,429952850,552487795,221814204,770616412,178550683,12780771,262877139,541795941,259616376,255569226,6289163,211253547,255820472,721689992,378527996,873568389,548799467,795754141,170736523,731303770,703417691,265584637,843712157,277961548,633548726,345496464,274305959,359680267,317178762,222355131,609459762,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 39719753,565918053,528500387,310816367,176461152,701039462,426323816,422491593,958637038,280521790,103563541,64538997,642658918,115481581,784820562,69474941,536049054,400532166,736376542,362104609,675179924,74362414,582124785,767944775,873727308,723000024,205538381,489080802,239624810,727241771,335592781,289077990,853464117,37207227,569991934,806023175,721172136,784247461,77489895,889138062,486426776,319276118,876627164,748185113,424430907,890280278,160671391,264014932,580547911,900138137,653067994,781824096,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 547851185,770441641,275870840,525902814,636078442,789597827,907397451,823685641,215792168,362250943,218589388,750994190,133561221,927020335,4813109,951926403,908556818,168827029,598783649,32113990,959735642,773128448,676194190,135815973,493803418,505109528,976760223,223589907,761669512,559129228,83700659,907083508,719458021,304845221,48668041,523011959,90699905,527159135,998606992,996172513,404523805,139310018,111259600,761670572,164355617,906261838,351221445,311694888,915843992,852491527,935991763,296706692,756600466,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 40192184,377470164,887789046,207633902,578113363,910247976,698410198,262394399,628599584,772563211,444995351,671122724,224063543,96493319,455305313,403589973,736773000,660928961,906997999,942116239,318896816,644957472,860494889,797082447,116597898,722565332,911067719,892632157,112564449,326809748,154128889,604000554,730199518,957953788,851516898,668743340,754546423,58189080,623619074,382209352,356189162,387999517,948187716,274900110,211945210,792742775,496428969,604897775,686331624,214795137,468832620,907831347,116487128,654591160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 772146975,741980249,856075632,33414036,573684311,462292629,514658095,447619932,799988357,469310748,455488000,170814848,243437314,613754480,668617558,684363024,829026258,476143602,325728596,611433941,808009918,976405493,456939548,960521016,242295040,521172533,761610032,930571612,96162122,62242435,629883189,300225191,71807426,159913051,294211488,521569762,609309106,480789456,735918547,84077229,305774589,391279029,294160396,927785928,29867252,727268859,791964963,666298430,83745092,619158573,865294313,773518650,442105499,366552145,171792186,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 235389640,455110592,548252593,343281204,558598762,976682110,557125871,575066079,37143992,639232446,232009640,364887090,240197954,994986016,364000945,757266836,751545792,625909324,52718765,237153610,624299417,757755004,823278369,18270469,10663347,771130400,767540777,671496315,435343173,428018887,407941015,994357188,265272775,166544960,394870201,426494380,805902072,624024006,8739209,461673323,330624131,545271809,268452630,527797286,667199197,742180077,537638513,729221360,17647860,723537031,207516152,730339756,430766231,798593808,32331343,748630189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 96561979,505908931,52100765,510455227,313617197,113594177,17655225,902194173,334081273,63478654,590414975,926140895,436740530,725928278,809088339,552086514,226385357,888596468,998239251,538554464,204041286,659988814,288984091,677926558,407830132,985387964,386180875,629712267,754556041,802302987,370244185,254505837,833239005,258076765,184454256,20472969,36609323,928139799,410421880,862630552,537238617,906166381,781180137,568581916,822569882,785821816,200546960,736642017,940220825,814401067,294182048,447253036,695370431,583540996,951800142,724762428,848074470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 724522059,164316848,761574260,840900766,149991564,195958169,193500946,81539605,961030930,337929124,783630826,105600702,245429671,110114522,293340585,41382985,510337517,617286638,224411711,303088802,763497555,870646400,782404965,15458987,120194255,858920236,422878080,73654600,194704924,741890346,772508718,35284254,567677402,776119182,847964884,101454043,379825760,913756107,659429082,436266638,380391839,140348468,757024795,570912867,351653844,130004,754234496,22472290,703616683,805844572,655786593,447614736,703481016,319894113,320087535,629057333,108495550,75742990,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 99758008,866280637,600757825,916210416,363982886,155752048,668360643,720362222,188289516,84779572,492686470,253516304,716168991,643612498,756317149,146925815,203554837,782902766,332809378,957962239,34827168,139206187,618142267,509728364,424475857,122493345,724562140,358251449,402153198,262483936,4978645,197460301,346965220,537205482,632866592,887366992,712855082,466659166,417372989,32956918,169665155,597886062,909856795,426944843,501761443,859857543,834449962,695985655,686232592,129399855,483538289,264828846,307320437,623404413,422675975,73223097,553984775,935346011,352494923,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 590658781,785793032,542605548,530332577,138165788,251694346,438057949,185382506,757268296,693773890,285528242,804057758,263484260,118774967,923721402,737831219,939946240,8722902,327785550,133875690,775015671,582112060,914037976,547950896,222973765,475324792,421430604,739600742,676179078,62164054,352352369,272988641,591205276,740232373,897587887,394111683,493306392,617893053,355859621,348734420,478771928,375112633,352053971,453141398,427593179,412248276,34715181,472379379,817514080,949075961,677719211,94642965,351518121,631850493,116788265,46196683,632702798,466961748,719372237,278101098,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 483755255,571265061,929805531,262802600,538652866,834217393,156585994,369800066,54623574,134068760,590017288,843761676,586617744,437925431,243900232,482034426,93064335,193701178,755600258,340838688,75069178,693146942,18735829,697629222,286234366,870839054,211651426,223635410,323223526,233083989,822045640,685479807,933881234,556935706,534238857,926706653,638975202,807370464,875190733,681222255,283441550,613530257,290472375,156799281,782007577,358178236,230920911,574639427,211876742,551160936,756347345,568121742,229032431,845262999,266994999,747800242,13665211,269818438,252347993,535688360,462072300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 757236145,393623266,933074069,607958434,885340520,971359262,894796163,250615781,42732871,405926222,923586775,312429882,370287692,155175889,50715155,570512715,302415631,138377526,65478823,71337697,545363521,353594740,159667304,110614793,229089005,65873840,890903348,483289732,607004240,692343315,425188452,436652838,571391646,341207693,330793828,394217606,574687983,890225392,939814414,308566566,20464145,459405930,18784884,428815851,806458012,99519806,228375152,526850464,330183574,390710797,70608735,873476735,684575818,224621591,985285261,592241984,597534954,605614617,471078457,458575386,57022287,334907097,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 74370708,728237123,31517647,698486056,793453748,909026713,470033512,153708156,940306987,703834984,50218200,402851006,796635515,315665629,533451649,206679390,370577816,731363905,853693417,687094443,207398679,292645507,155116125,908955227,272198425,208826494,545152518,895102060,507007269,164985381,909472429,928544992,497328771,866196173,140346900,41877849,767953789,530957651,70164369,488703645,750789288,983627939,439842623,265886544,446539108,309100463,296859931,623952346,664527190,92776512,825658286,202280270,297385629,415624477,943640040,238617327,215028795,536262419,915666887,986146883,361766110,652834093,10474572,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 967838085,994420980,314815639,742317606,713796321,267621954,121015925,361307650,792002014,314094041,949928551,44530471,149173890,854127017,33926563,867460808,357940733,722483746,268366632,513153271,656628963,336816029,330474457,362918925,1995465,577091806,735338629,810653897,718749045,66078053,71763525,32084689,251907687,902985647,738367785,515989656,773261840,983953343,795687899,802918663,734540747,284279438,572068337,598595772,415736566,385907103,433625984,370340891,704247903,445018741,377232420,526992500,566826465,11575969,522618771,943302284,114152110,447330356,12955677,917856315,978594450,490260095,380650685,495625635,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 784320876,14277399,491376956,988559613,192811225,362473380,678089058,897905630,82309036,110234243,697183816,946053452,931728856,250941141,928431098,336863323,141705846,783540762,126760507,330513743,116278311,960351780,108341119,700032999,449410127,969979707,901023137,457674810,648619879,149947527,408816835,86301583,348077372,60414327,205961852,663055028,690160195,582426219,485741639,608712261,196451482,464155657,974986521,941623678,539601776,945825059,256055618,707713673,599704396,248292888,263562267,859139604,59129864,455702441,503761571,543879020,415651630,45770159,155928046,72480865,972914175,795113128,550933339,181038837,586051441,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 290699095,997482681,476634938,687089530,625755413,994025794,137654557,35059557,113120521,952046855,157013742,643024171,555347441,778526683,561484450,742065738,452557325,603724821,607441168,167132016,826116408,943488548,938826998,191083964,97918479,118860402,899757466,510933051,849383407,645932050,740253141,144753281,407921830,531651008,38844454,354359496,638446984,336736184,390914915,3778283,613344236,17772525,952986992,966848228,387526868,800348606,994814059,234403778,257035177,626836969,90687931,664397142,954090129,643773993,245392543,56276593,973515112,329888459,796695563,187982810,93835402,668260978,885619983,507765566,589520607,159996073,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 838529277,880289418,535626390,427847410,842535497,454452052,945816247,299788476,441656423,717687261,421782848,618936792,661740236,991069603,374680690,968182316,85688713,404068007,865946525,821318004,509099896,94751468,622265340,241413368,94973148,32968457,834522216,904413331,253460625,768786826,346450519,294165233,726633643,121522642,441251871,539219003,19337519,47562508,106885953,603099799,62232073,685871563,933855504,781430573,254050846,818547857,645136869,674680128,317617310,252059119,104309372,91948947,353181941,420803309,41688583,256967809,92043859,514252258,502640306,392253526,748827812,159764155,162253683,601812756,177919689,926887986,479379757,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 301338962,684315685,525170643,886078238,228767585,129218287,127372233,974385558,852695120,680129236,568090336,510403297,352725479,411378382,364971157,828132262,301220321,656620741,983878034,68345779,344739955,638128084,216038799,659495834,180142452,450365153,593937049,469018261,858200201,364924894,843011862,763540741,898779460,861109681,524026842,172623009,214961004,199419320,119066391,96108059,309580492,31903662,534065064,849686215,567461483,368778901,571490190,976004393,758627443,947463311,461722690,452234911,318368588,750008711,481196488,847670200,151891152,93759106,989508121,10390794,962477722,279278171,560214022,255477311,962687713,655560919,29521392,707597945,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 354073061,356339804,621250698,254568000,54951701,143347978,731515872,603838201,430664109,52819884,48710874,252889245,95273031,618848619,544984651,199516276,940944069,334067965,716423665,199208030,949507652,134469367,185627209,155904314,982088845,562287766,713483638,592426916,372761848,589661219,610648625,311907151,31916974,330016612,191596078,350410113,799765451,529388016,977361187,560225836,734792729,844162222,345329501,108127169,610157461,102422770,729625403,181265753,719037032,560185604,24828047,548329644,401928684,608258498,847939664,904554069,987779904,272440049,210984066,66646574,220635808,855057054,451291853,778658893,157187935,274376780,953863463,260569635,561063550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 387555520,331460811,288670552,475872614,374590935,322653045,826258413,890200759,610395692,421930713,8027791,202995227,841840285,944876400,663424395,774157427,54379204,730355359,197951353,160865915,206406375,765798932,740484953,288267649,120829198,515436769,621070797,510669846,800349357,714643291,744881633,566845392,824262813,102970232,744114220,383130127,316333575,109810837,804384662,460730115,52062015,265854910,406824074,413851284,755686707,964442743,948601414,376279463,842962236,638409360,426937562,408651929,215696769,897737086,92881006,179071422,129213402,46937642,791598095,699511911,832807657,83271299,649705555,27581889,994583226,10036537,89183569,95505398,978680484,974840072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 303671272,790419570,715243749,308877502,657738364,404025454,60938031,245451227,4800989,336859859,913979974,581473532,915004304,463175964,873901758,53800595,571998238,338552253,91575888,971192560,404401627,551322092,334446898,910302161,413079813,292029749,294248641,46682564,453791492,789462321,709911403,486571206,734438761,206302937,312256920,271618375,747002024,950784431,517479270,841852445,602140776,499801567,989879709,296594825,56488603,399230097,18724073,989856148,839600435,895652,127374673,646295336,217797127,140775147,913712892,511159971,327580780,110468238,39921169,742274118,738766762,242834869,603661721,272066876,615440638,67668832,194964989,516166203,162389935,676828712,209152841,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 435210570,743671681,925377009,588885346,31274994,508829161,18627053,919497815,560287690,108774592,95986232,140430010,670367902,697132221,449921855,909173154,325912915,455065350,17093438,667953734,711676716,319849400,603906380,489923598,494804319,183418875,182160650,729577691,945276869,745074058,248651297,429179325,362872862,615090111,887005086,743284090,159617430,699560784,77132809,305480434,635023294,24289121,626150902,422319674,211684576,638582136,47115323,592682729,906133600,80753779,239658180,208526837,308976275,214978999,994173497,982132756,747147466,628009153,784532960,468457235,354087891,776789836,602508197,174689507,896953442,297205104,226423682,133334558,163453555,894880977,251157559,906106015,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 109593449,19294252,685922207,566060658,968532493,515960641,990419698,106841901,108076450,911872856,863979369,173095484,337066093,893370510,392569547,280567008,73775619,813694364,65337609,48901202,921538874,118180599,23703021,787850811,606933366,333965593,908334502,686080819,645974924,562592032,985397088,742272163,975741144,84692724,414914949,854689261,643607961,772052195,994866816,684471865,638499321,658700814,122170560,572403889,808871973,124789444,105994613,957697341,848733720,173141377,987211185,637173643,844345448,648643957,854655484,201778202,554164652,687807860,33477997,449784879,925538967,574116883,790164454,778847355,21832411,398129408,203505110,884943992,308965168,543641397,684034260,293754111,467465396,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 980730052,602727474,353558184,191329079,239925020,192287980,217538035,656858841,66083580,476601142,567114189,496298378,953820382,828647035,456045181,476129598,416112903,430657997,779536704,460954037,646507482,901248774,766318870,994737807,237339734,286520772,190941094,945821828,626974785,581606733,975198058,373665622,562523121,707277925,57095540,64584175,362206155,941870035,716570409,513449599,902875709,37328276,100937014,763443815,50372715,49658819,333880469,722933168,572160474,665387137,834266493,78341161,25933474,238061250,315238107,957821203,946342985,473152267,390154340,773082120,116199832,870574256,128786648,103416367,63369212,498676089,159482156,441988948,919921817,708190002,16620502,52136169,445214134,82034048,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 934750343,364768337,793206125,136997469,804661845,22833200,567648818,836868376,907351882,908161400,946465139,805373391,855947505,474891536,411802282,212372451,259668836,529439915,383990748,478184396,619130341,82189165,542588203,623148753,313380133,921218788,42096393,938459820,239375700,555084107,592803445,130041546,144255968,840954884,421681138,481790921,655690827,746280162,944456901,800266190,884907091,920182619,867715565,618884249,220412327,855160967,164116390,801290349,103112274,836481348,939592258,504309615,953738801,745803504,352638883,218899532,228831540,45860460,102341319,585992280,330060580,349971983,614025228,219486644,976715774,308195105,274477264,849320393,465684038,610848059,910660648,686847951,897360021,486870164,392794164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 448644733,697423318,712751206,433552712,58578124,739372058,298746764,626086905,456499124,811355904,293129883,224818269,417369620,164528222,532966517,707050362,142838833,76451415,464285832,137097011,201471343,509512154,685151133,590597480,555022180,84813659,105728121,163123905,961354244,540789472,213616617,558751220,129540892,833496193,927944968,958620033,365326254,677275294,804089589,970937494,632547162,625648011,247426219,684283397,603847483,698321168,36233388,923676122,154233305,696976846,367764586,481526821,952186054,681271034,998165402,174143304,14884836,514311865,684002470,593850666,275110762,106101231,587189423,836847603,722668352,281692166,672800522,217962556,133045402,619698910,947863832,594835504,251523615,938956123,495813386,700950185,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 315387740,642012598,280321939,777534166,5238791,630254217,778911392,936108166,183895284,170223054,354347581,246157245,54071767,244493750,460230709,643073427,705840120,620189306,894718618,210641196,716397790,859094827,578208985,308424099,267625445,991661966,951588145,632450968,979910007,10128652,793457265,678618785,488180757,378901344,615102634,517521416,922662853,764929849,466458357,170085510,510027599,472450248,130932807,81482101,844929934,175774537,21764795,415568844,428896280,995134335,861930552,164267772,358280808,593407459,903447187,186404851,90714625,223882813,355400449,416512939,912392910,311310465,624051785,326588960,958570085,530794767,536705527,746539829,805400310,415718710,175600478,665854382,204514455,968798768,431898287,205847744,344807921,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 852448876,306161793,696551611,705904047,455147993,577848222,399303983,752467668,20301887,41098139,747053328,80768708,527881581,526001620,602944706,380204696,429727421,600790813,64203366,811028197,245915411,752632163,116841341,619271212,315541099,743627361,362465499,716237611,123254245,210315444,989660591,359823187,6000597,50953802,980943579,854503625,322567693,350470653,814180253,549080210,375778471,97442943,938035072,330144412,642445365,553523901,134726473,64208364,4822835,670903902,836392797,210133030,900700581,352901022,12238919,281266657,649225676,40495941,186245284,195090724,123247464,99294358,861474960,826312920,848421498,941867585,241461977,789544127,640640880,866301619,872848105,874362873,9073924,486061055,642789215,789117093,383218332,475335490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 325603801,345746047,26360098,675125076,506012109,609026389,872122080,86829575,751528017,447855580,729992255,874799958,96411938,167395567,963332587,366153907,617374617,123643725,210055288,645657083,548108486,974037348,91031125,359914889,822515295,168985034,643193139,448960181,196087326,382906874,487487688,360074745,306301319,62460100,392995729,505271922,146522980,428760891,89069960,106987538,408065484,189419858,291815046,791925413,770733571,692442756,588469690,202023892,87148907,865578399,640112711,179405014,440204964,637068971,939522305,281848351,127718377,724844069,214345190,521836688,74850961,48661510,319482628,948381685,127648829,272601295,822285123,351551459,21357000,848949157,73764974,216837572,989425864,654459410,481693295,893858406,228557733,489858737,496881113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 446253865,186451840,534677391,590482279,803045702,502820876,932395829,331799956,378024041,276513468,631110653,584429568,504968996,23567256,750044691,718635797,765264965,937841655,920011081,97503747,555532175,51303455,144957142,564734040,826143037,213933254,736106984,640580544,16158371,654652632,169327840,7023808,666751884,466630685,435194099,441873677,826861652,329940809,418564826,738883171,722801627,553410963,349759407,476536817,314852916,930898361,401083981,182843415,529476614,748589757,524529188,947328363,143115469,633744886,349976053,433168139,208445558,117356587,792808484,45632610,728489218,4412394,774094901,980658550,299812616,474812697,520385968,996896725,152818933,887470812,159197829,146301105,984136308,923545670,229607877,874788154,488602713,695877184,101845182,358229039,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 345804959,622515219,397317811,760333217,451764308,504005544,261393336,327999999,862287424,771266686,286931252,747991372,621014661,696071656,172785499,778403057,768525186,106563348,101226411,347618399,632381853,723508887,897806648,172682082,357428819,264497370,488428974,74187395,552155514,414209334,732063617,448466615,33746274,269064251,711547967,289498946,112438683,788333688,835848151,287888826,796503521,566477855,440158378,708351453,684687830,148729930,945663334,379707009,900140283,343155679,802785577,609119898,31462282,131479817,340417694,751253007,13208530,737561752,752896468,286666928,296624739,860549921,130358212,769992910,63886353,602728395,542876394,118723350,643590499,507990239,99948951,792311601,600061642,799560162,81838706,233496847,739384858,141719906,647771733,165850381,519104519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 853226491,678867560,316328292,325163325,303356087,154013384,689395148,274604039,722884815,456338728,268851433,477400053,385121291,974659285,856878903,170993441,116160735,670695572,695440585,973290934,127117245,961930838,253751283,766857529,510124730,764860437,934833731,633394595,501973261,759600830,930246077,609428367,432911182,356583510,162930408,699344253,370734519,413154748,610208333,541679255,733198518,143378327,544877583,993741119,986676491,869462309,240602206,794333832,231238857,372003323,858170812,816202861,467406403,619705510,931004086,306527407,55239842,877703328,921572606,368787402,257439124,317720488,570978284,816223180,668654522,324943297,772613099,445858862,886527859,199487590,164849059,380561526,767448168,984157308,193948438,144247840,44057241,718164342,844089939,836645280,329365014,784488542,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 404416244,553971473,853164524,235816804,978129652,836460081,396729836,130538121,338514894,739175510,938260395,959988628,271891574,938045629,955868279,856522628,75154701,528932990,422138870,834947158,230484764,826739407,787855898,33911945,480288294,768572001,934039594,852173152,485377692,278473153,641219890,348819813,625830808,461363987,291955770,470376723,140702209,404139992,743022673,821361765,523161084,708255420,335144386,450479139,170757255,758861176,756860336,53256497,616933922,574154314,838965432,6085561,103410854,995480976,694809432,361592030,737385966,826379367,259766931,112255563,198698339,24174754,686986743,222601927,704020426,993692457,899475278,116915374,356382738,113457980,95431432,557376513,727424166,526096130,572860287,381556372,610587288,9733385,972058571,858820329,358697963,988899727,665151655,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 194919836,769101506,896912896,50946406,156724767,302624845,286890461,685219155,182098915,641327741,195043207,644233624,290452022,117008570,11873063,336520814,245149286,898170031,209296418,154711004,460243115,923903396,941311222,430555685,653877825,684757261,133120727,814954951,99317634,145216197,11009971,606993403,684070614,552761481,17270430,63283303,198075016,729524806,782666973,230491043,947021067,309767173,957312904,239341439,607621197,292637495,797526893,677601353,751731535,541161985,936313608,544038971,648687762,1198959,342290706,872645689,341394073,687512724,399466901,773825200,913786066,306544983,816819662,54209995,151650284,8021785,540462174,195804966,85100879,924965945,72425981,900364347,576271687,894692420,376339218,239307955,506827335,304277804,803766133,13695493,966761623,980662220,678859516,307919717,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 56132623,163816561,469329692,182964470,280546996,168284089,834415511,564056141,48699663,740837645,227167225,953665785,217827448,60071589,923720753,373652682,695366774,728198575,528294833,95885439,978495822,163296233,14193506,772545116,118167820,166862397,318995648,593989101,85570675,327323955,132262601,324054290,351422778,342206590,871168401,513669026,177633950,800292399,382097887,719063585,862805609,612394647,457026820,262168832,434005298,776943739,297660467,232300466,909390337,300924081,165916479,894300055,303530385,483934245,776717199,980642752,346966630,445073134,927956560,436982416,259452175,82985262,864349397,327349936,529003526,117057863,528820570,938590412,693218317,805423145,349349990,981059732,660997238,698346260,15891961,373257720,843955231,193843075,714962768,267260919,17970218,954952644,323719829,151275784,591199688,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 924253322,456217755,628950625,379997707,27190561,63214604,104348059,260108884,66267727,925616609,286736069,976653430,544035231,273405779,372295830,946604454,650881138,968857836,436875364,824760209,348317131,742980357,499770104,900560177,170294785,446895067,898439335,601954728,197069189,696156750,473403712,414775180,968697217,357780946,979795731,420326034,529303552,198822214,230862006,375035616,690822101,426568891,980985311,750351191,506237766,735945670,8230380,33851425,349867726,109011071,758229243,259120720,81972357,151991098,463233683,61842269,329268108,358109565,382937723,231674709,442339195,523246140,363113848,420944605,855803003,532934790,225910880,789237222,891756288,948640618,672791977,68382284,178947519,645836518,938923708,959019261,259112840,490357222,315802794,847117237,317657180,756306887,860634149,865444055,881756424,692769253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 758769224,912490674,159645747,504072664,777710069,226839900,874123152,296121594,183866143,700415908,109732415,75410161,516378258,880314389,259434274,530995976,399192188,857509476,573439599,835501675,441999875,271129364,626297241,880816728,812005467,317939892,561553343,349167256,196064948,977692070,433407789,516086657,953369713,187922652,920273445,509609567,105141382,340650534,349100641,610440088,446439596,576206404,100085089,494661020,412411683,306979208,148583664,136649468,927466074,134059445,391430433,626928992,930005347,237698043,269967976,785310227,557436242,377223888,427899742,746789849,992672898,46032267,572266926,158030916,725101704,206638082,527460937,525460996,767707003,889226941,818047864,68173335,979981350,308273296,189630454,856755976,705756567,562589468,753221532,319959030,186822655,418189175,124434995,796390405,270303833,939048604,335414677,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 51090665,318279309,607048015,495494281,35920527,954324472,559474227,439123501,606086289,816103086,68176041,737019245,183362135,481412835,198960744,748642253,190501174,38096853,270889653,163088778,452462397,827934568,345234345,120800246,852947985,154385834,314491124,558122313,174569721,664007631,892879499,479862888,342055287,64651452,398681959,339909184,205359685,403652263,866824569,567919040,398858828,944214872,31370239,815148518,727525716,526535801,490272831,548770541,318795415,52610045,325851310,339501231,735823889,235614990,158259909,787077408,901771650,571840300,102739569,210506076,822886874,736289716,351944596,536596092,333360997,232297011,717455432,259704174,722142336,543927531,113193385,79172065,803559831,640727532,946489002,440587989,852968592,579121610,241321533,414323585,514042816,629555939,697611503,772450102,228165259,180684935,828647019,884560880,0,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 211778367,812676739,134946853,792031414,914490223,318479870,61247664,481726062,80350757,504023331,652594255,712273533,142776411,378715045,712568320,851697133,10322234,338936679,502091221,716622755,336652770,998419018,876607862,597778398,778796991,581903925,853451010,94159690,776854476,574823381,180691801,274545226,121357206,630356050,775278101,632210636,532409998,708556310,597807478,927546812,106544347,452226180,949917329,672802758,411694744,848856082,736178686,29172395,743239833,574767128,267742292,517669865,614825896,984446559,715148792,969129282,61797062,140948881,291419321,374001861,222524402,552381020,243461923,964331781,689187541,870096723,191386753,336834953,68513974,255940044,999390644,288364848,582516047,390209492,766803298,112083595,545202755,599294617,784634820,250664977,719140059,385189329,107240608,246173252,409024449,923522066,783630102,644011234,847374378,0,0,0,0,0,0,0,0,0,0,0,0, },
{ 761200096,965447894,40635190,173588654,61365529,659350384,907557776,585172053,260184293,602917891,854680835,888717311,78833086,956194642,743751845,523413438,239078623,912124698,793226555,50585322,116354142,141934313,87559308,944870696,421597727,90764591,203965244,669545579,137367238,858592763,341171983,415850496,788426992,145796108,616008324,649809499,459803069,12190243,921265079,377852648,644953611,316754564,694486900,366984479,493323492,857143242,859754173,62795553,749992057,181124589,470522316,337453165,14210120,962916076,726803270,70570950,911030127,983343389,444163610,813784582,969503605,90606011,390440019,740756410,305297528,558526149,649060640,928212219,876495898,271549897,931943245,897221457,656434626,564720453,881490306,968638803,885754373,755590154,801772112,20710065,990717238,129460718,342392901,635073597,725304477,255981652,24010501,601692254,8035980,791103220,0,0,0,0,0,0,0,0,0,0,0, },
{ 214194897,390774043,892316708,225040171,174446866,426349630,729045072,781117309,856862381,360673608,652592761,461756618,503163947,31023920,414856709,967194670,612981539,951401477,652275149,524579741,265652561,189823170,914708281,269535799,987957328,23301553,302506442,465516428,816879865,970054518,201007385,350758021,290808850,838969979,309703923,515585378,106423467,585213359,427069592,3602726,768234511,208825087,10550363,281974575,875488087,125860937,847120068,922704627,65914,561103286,288468019,253923925,752317192,471707946,519486053,104711705,347007898,915270829,973910756,309674060,263448820,260002713,915107671,247781369,21867246,541418628,760692958,711208292,872856810,465735088,173446077,742151066,564753171,829674573,969462311,407141983,191948190,21526998,383964956,608064751,246443535,239874230,515647733,390629660,732415136,480001577,783399394,575058787,421596920,759277827,200350027,0,0,0,0,0,0,0,0,0,0, },
{ 623398829,915536870,567545964,956553305,572800793,490812887,181716417,167670537,202760097,536168901,985689258,840351251,993167768,221739203,924641823,326235251,513256492,428518883,574896913,898363002,168251439,708265836,439185158,493237280,995945537,824914932,604945334,701311625,695394311,24604881,358136046,302114858,940045343,756967183,520349750,925603397,550992966,848360533,824764614,388280496,495632591,875846194,290919477,298187897,159517934,434888278,223630840,170684588,296773741,735425177,280152509,880481271,179570313,418884622,797290814,822057765,935717876,340900169,947676731,655830472,381737824,142136724,300187578,724501160,494025423,629302707,706056448,378106122,936470943,844294544,392337875,445724768,763257275,37330460,713123643,31296379,689373643,612249201,980460573,499334683,973329058,466214244,615553477,186709778,738876812,174858214,424743823,982083129,343375781,701391225,542393076,485480275,0,0,0,0,0,0,0,0,0, },
{ 188432705,614370559,974202640,173744071,836006517,659455230,863286148,248944869,75261406,492713295,91701738,83182141,83326188,892356989,812187248,448633173,674295945,165329842,556179052,735244739,136527054,879004837,492809255,135393,428467230,168559406,330152640,286695857,454145149,523461165,597603077,555082536,116720942,643238536,863198698,470289760,634599288,418834168,851813880,679330781,332906759,98770007,249607396,71512068,851241121,659992506,641040607,704410113,2515560,8324332,396316585,945637540,508961982,792752885,15302071,731922266,619737213,844920988,473896940,328158439,617713143,63650868,677661564,219582711,710074089,718852400,147352690,917701742,364631328,814759227,565748612,928499016,54675259,228422133,330744656,622543462,192295761,305655363,860218331,19329433,927665554,228319086,959856947,19297338,726277380,765019894,758120358,24943709,437026394,380864597,75195437,264197826,557337842,0,0,0,0,0,0,0,0, },
{ 461050839,940095719,726216008,370988394,399089981,640594532,372985216,390221328,190078391,164271251,546203583,708503399,735832329,438853502,840502079,936108685,998851297,1285938,997814540,640413046,647317270,757249392,207146488,348197975,792773978,927354999,394163842,826558043,772025056,584654757,310298507,422051327,543902884,715187389,123431846,787601113,407996216,790504841,131859886,367437351,371547775,46859685,627211019,868631227,587052443,164077700,228371808,957270988,702709932,591102317,951700422,47370593,462436951,190876167,292299840,364850753,781293168,905551105,272170497,477853986,936586130,249735298,657129234,316480537,711916138,625450869,353820638,752930531,714001215,856226101,637649031,36049433,719925093,401513001,983353068,880850233,97425104,909889728,195458178,756959696,667000778,235263021,328999692,583731731,747343913,185790091,64663825,220767428,468745707,750282455,115624377,431292339,478404921,434181960,0,0,0,0,0,0,0, },
{ 437294226,765252649,399388056,929465150,468398487,127669538,31276744,223627240,265496232,342258280,809154039,237770677,306207496,533085090,366916207,416999932,393797032,759212787,885718216,748564753,451856769,683110789,286270416,793829869,811495413,996361911,709241376,39000374,602377191,982844092,710715904,770330444,486781639,754166121,282235824,574981633,368730171,221846652,575833487,284674124,926201604,453734800,771138352,993117488,68361997,264004557,109457789,433615448,516349103,548872217,777946072,16826878,597948768,302030376,649093574,582600027,788952227,650868897,668613902,238442422,761062327,651632512,25080207,723756599,174137856,675736940,929239830,122254348,978562090,543364101,827141365,800830784,556827061,417331262,534148197,481941256,462842813,757385436,365793473,712589087,432755404,248866647,990067622,893057642,630231135,542198549,280584843,513153357,892941873,863452059,242846784,71998978,762727079,741220030,73976309,0,0,0,0,0,0, },
{ 943343284,347864794,774528575,668469657,655065169,210045655,522363699,623662987,31353394,524059945,627900743,276661418,194826,298598305,129142053,797990107,965900405,667686485,380211356,13621558,977082824,270374371,561026104,46362787,366598987,158666786,22287696,685591452,511250698,355550396,12326827,117615796,579929984,782815320,166584270,945663410,803248548,114758374,644451416,989266035,269621448,963892031,721699686,44357018,261896831,58518171,319915356,545327272,468551244,153053080,747061691,863718316,962366083,192553250,343120372,479234765,873318173,950393081,552942447,286868051,553273465,333513824,229370006,734077851,723792426,852331821,983592572,488135902,562199658,225565657,473497838,1740428,604239796,209344613,22205863,77072602,509011612,277322022,175949414,786762381,498031554,511975535,810321629,303366939,888624946,304205176,595904302,363493563,810258402,28163663,467775145,23568228,300087824,27478086,159229755,792463021,0,0,0,0,0, },
{ 373369594,524259497,964207184,780262034,575325289,861118758,532427241,113814064,308892552,774060602,910481944,507199459,611620657,641676728,602570830,209509300,817224582,795650896,239610809,401378406,91060378,22184166,771017002,341735514,246333807,131714134,265887866,653845526,784814442,295053746,15820202,625612605,135371064,412904880,30792197,197771288,370518954,298204958,320034928,33873696,205280711,904811578,466514278,746378449,766352191,421469026,864688638,672766165,369303717,71516839,472803254,63766905,520846686,381608201,964751681,736885465,105481912,882736519,560609778,947106264,685563661,558936624,926079453,428348087,515197816,305245599,805113740,177686195,543886394,354189455,639578566,97616943,895245640,71705670,667174255,513191573,53606975,180545758,172736035,482219949,965871803,132582981,741511383,892527288,759436432,217594004,56853153,346386164,975524870,672564734,497713390,663502018,516810488,903754642,358996755,640573914,462067202,0,0,0,0, },
{ 357617306,867153068,41751851,36460497,125330880,203595267,255531916,991131397,165141306,144072712,859396779,666578529,584239051,569211894,842100169,547853235,358018723,777644250,112572367,129296717,816034800,713304948,821180616,532497068,344657698,589877288,721813239,80739703,991345606,494539507,546058540,297908515,34072793,556988496,45439520,888490218,67933181,818288152,391950699,574894420,23528451,738222293,558274900,751686440,465664488,435213906,950827114,692428501,805529961,137262326,862240362,177808348,17702752,580727488,475796247,188011572,463094318,897414874,692025787,668933326,663093212,978951435,881389232,568004816,471983944,482272272,684399283,265728887,547938618,776363816,775383319,385026371,674531456,346104265,774376290,149931685,605188283,357370384,80624597,297452041,751717861,136697939,20920222,543883249,409509551,794219942,381021142,624479568,519375082,255658155,985313869,976702782,967015301,959565313,222404620,29894017,477397415,677783523,0,0,0, },
{ 519160922,352921658,387853762,185400053,431960061,189363247,995883735,976218245,780440508,514981334,802442109,78222683,52732441,672311049,108812665,821815750,668628100,851170036,361084268,764465877,434072852,407564139,16494063,874761566,839709168,897953563,45427142,665536927,525709947,623302998,276584723,607168467,119485401,600506996,857174719,880779385,344934599,900583553,124144752,951496535,833345122,305137726,112977496,509917999,153095409,430756896,242746593,132100680,442417292,211360541,979196542,60134591,533073591,707339379,875276282,881419089,225277219,21755095,903162570,535190895,111203511,302262973,559116292,637879630,119366999,845171845,231811970,369652158,398424871,290143224,119066689,484948564,47256744,742149647,74955485,667478109,277868588,458579818,725889487,786901432,709318060,176012489,692225773,468161400,641564147,719492414,565334737,563687307,665346034,857407559,53686682,87931260,412562127,985066059,707621405,241064115,581376026,732930030,295755371,0,0, },
{ 746667025,988230280,578857395,943173280,23604671,609159282,77472710,209042115,129444948,809436586,733155375,553132986,165858348,517314464,182707694,321308973,148879948,272054159,453293220,118007503,586789153,589740011,555141252,848810118,493258309,885969006,227477067,496186334,639293482,552525595,737960751,184729160,509192821,972157554,157170470,83322787,580419690,525213566,498884762,922810517,379441293,405175652,51775494,913077450,605380073,942108469,698582616,265143343,325602376,131368951,698399735,533027689,691072374,916310164,138815047,228002188,789670994,278352790,787446480,993755127,544791674,985067779,471551591,162213585,635614967,449752557,619966203,274491156,638711664,481182769,441677306,98703039,721084233,456074841,720861820,369766918,653247416,10978275,819090107,57678777,130923380,417256721,994085211,231518716,193054665,760293158,969362083,410706882,962996742,443951997,195700389,509173481,693173338,307013209,853551581,525816193,966638345,224676430,194209718,435431099,0, },
{ 281603733,138407398,86019269,423308164,628795846,196796182,753173513,211764797,295659241,103252080,288984637,771817728,16686897,911761734,806397108,707831875,367736611,552407519,611427745,718194558,336182887,810354363,887085822,909120864,176944207,791461859,781904784,510230751,5315151,713990472,643061399,514126877,586617380,141247706,717662001,515959429,921071412,887143166,111509430,677896109,927611633,470842496,323293107,483632474,358769673,592995655,738389897,604489119,683802635,357484946,492249407,408062292,680778048,518340476,587555941,439454013,349031703,958250869,501459390,781878478,357327972,241401516,821549611,688310064,604285228,247863808,577392423,986288040,510121040,810270456,705782997,135408659,222045211,109164359,546498796,735527859,499665364,920156496,454090236,45419401,872538891,937602773,873764254,498024959,825571197,183796880,486598130,830745106,971488731,968532926,653339758,85583050,60685446,991118276,960698403,525607421,217367693,585600641,639945593,481066808,193120002, },
};

void solve(){
	cin>>n>>m;
	cout<<ans[n][m]<<"\n";
}

int tex;
int main (){ 
	fre(floyd);
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);cin>>tex;InitC(),InitE();while(tex--)solve();
}

C.字符串的价值

AC自动机上dp板题,没啥好说的,注意别完全暴力枚举就行了

点击查看代码


#include <bits/stdc++.h>
typedef long long ll;typedef unsigned long long ull; typedef double db;typedef long double ldb;
#define fre(x) freopen(#x ".in","r",stdin),freopen(#x ".out","w",stdout)
#define Rep(i,a,b) for(int i=a;i<=b;++i) 
#define Dwn(i,a,b) for(int i=a;i>=b;--i)
#define pii pair<int,int>
#define mair make_pair
#define fir first
#define sec second
#define lowbit(x) (x&-x)
using namespace std;

const int maxn=5e5+10;
const ll INF=0x8080808080808080;

int n;
char s[maxn];int now;

struct ACM{
	struct Ver{ int son[14],fail;ll val; }V[10020];
	int tot,root;
	ACM(){ root=tot=1; }
	void Insert( const string &s ,int w){
		int u=root;
		for(auto it : s){
			int c=it-'a';
			if(!V[u].son[c])V[u].son[c]=++tot;
			u=V[u].son[c];
		}
		V[u].val+=w;
	}
	void Fail(){
		queue<int>q;
		Rep(i,0,13){
			if(V[root].son[i])V[V[root].son[i]].fail=root,q.push(V[root].son[i]);
			else V[root].son[i]=root;
		}
		while(!q.empty()){
			int u=q.front();q.pop();
			V[u].val+=V[V[u].fail].val;
			Rep(i,0,13){
				if(V[u].son[i])V[V[u].son[i]].fail=V[V[u].fail].son[i],q.push(V[u].son[i]);
				else V[u].son[i]=V[V[u].fail].son[i];
			}
		}
	}
}A;

vector<int>sit[20];
int to[1010];
ll dis[1010];
int use=0;
ll dp[2][1010][1<<14];
int f,g;

void Movet(int p){
	if(now==p){
		Rep(u,1,A.tot)to[u]=u,dis[u]=0;
		return;
	}
	Rep(u,1,A.tot){
		to[u]=-1,dis[u]=0;
		for(auto it : sit[use])if(dp[f][u][it]!=INF){ to[u]=u;break; }
	}
	Rep(u,1,A.tot)if(to[u]!=-1){
		Rep(i,now+1,p){
			to[u]=A.V[to[u]].son[s[i]-'a'];
			dis[u]+=A.V[to[u]].val;
		}
	}
	now=p;
}
int id[1<<14],V;

void solve(){
	cin>>n;Rep(i,1,n){ string a;int x;cin>>a>>x;A.Insert(a,x); }
	A.Fail();now=0;cin>>(s+1);n=strlen(s+1);memset(dp,0x80,sizeof(dp));
	for(int i=0;i<(1<<14);++i)sit[__builtin_popcount(i)].emplace_back(i);
	for(int i=0;i<14;++i)id[1<<i]=i;
	f=0,g=1;dp[f][1][0]=0;V=(1<<14)-1;
	Rep(i,1,n)if(s[i]=='?'){
		Movet(i-1);
		Rep(u,1,A.tot)if(to[u]!=-1){
			int tar=to[u];
			for(auto it : sit[use])if(dp[f][u][it]!=INF){
				int bit=V^(it);
				for(int j;bit;bit-=lowbit(bit)){
					j=id[lowbit(bit)];
					dp[g][A.V[tar].son[j]][it|(1<<j)]=max(dp[g][A.V[tar].son[j]][it|(1<<j)],dp[f][u][it]+dis[u]+A.V[A.V[tar].son[j]].val);
				}
				dp[f][u][it]=INF;
			}
		}
		swap(f,g);
		now=i;++use;
	}
	Movet(n);ll ans=INF;
	Rep(u,1,A.tot)if(to[u]!=-1)
		for(auto it : sit[use])if(dp[f][u][it]!=INF)ans=max(ans,dp[f][u][it]+dis[u]);
	cout<<ans<<"\n";
}

int main (){ fre(value);ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);return solve(),0; }

D.排列

nb概率期望。

只讲如何dp,剩下的粘题解了。

考虑每次转移就是添加一段,枚举这一段的偶数位置个数,这一段的贡献就是建树后各个点\(\frac{1}{siz}\)的积,考虑预处理在已有大小为\(s\)的树,添加一条长为\(i\)的链的转移系数,分奇奇,偶奇,奇偶讨论,具体就是枚举偶数到底选的那个,算出子树siz积,再乘上选奇数的方案数,然后dp做转移就行了。

image
image
image

点击查看代码


#include <bits/stdc++.h>
typedef long long ll;typedef unsigned long long ull; typedef double db;typedef long double ldb;
#define fre(x) freopen(#x ".in","r",stdin),freopen(#x ".out","w",stdout)
#define Rep(i,a,b) for(int i=a;i<=b;++i) 
#define Dwn(i,a,b) for(int i=a;i>=b;--i)
#define pii pair<int,int>
#define mair make_pair
#define fir first
#define sec second
using namespace std;

const int maxn=2e2+30;

int n,K,N,Mod;
int C[maxn][maxn],fac[maxn],inv[maxn],ifac[maxn];
int pw(int x,int p){int res=1,base=x;while(p){if(p&1)res=1LL*res*base%Mod;base=1LL*base*base%Mod;p>>=1;}return res;}
int Inv(int x){return pw(x,Mod-2);}
void InitC(const int n=2e2){ 
	fac[0]=1;Rep(i,1,n)fac[i]=1LL*fac[i-1]*i%Mod;
	inv[0]=inv[1]=1;Rep(i,2,n)inv[i]=1LL*(Mod-Mod/i)*inv[Mod%i]%Mod;
//	Rep(i,2,n)inv[i]=1LL*inv[i]*inv[i-1]%Mod;
	ifac[0]=1;Rep(i,1,n)ifac[i]=1LL*ifac[i-1]*inv[i]%Mod;
}

int f[maxn][maxn][maxn],g[maxn][maxn][3],ans[maxn][maxn];

void DP(){
	n=105;int inv4=Inv(4);
	for(int i=0;i<n+n;++i)for(int j=1;j<n && i+j<=n+n;++j){
		{ int res=1;Rep(k,1,j)res=1LL*res*inv[k+i]%Mod; g[i][j][0]=res;}
		Rep(l,1,j){
			int res=1;
			Rep(k,1,j)res=1LL*res*inv[k+i+(k>=l)]%Mod;
			g[i][j][1]=(g[i][j][1]+1LL*res*(j-l))%Mod;
			g[i][j][2]=(g[i][j][2]+1LL*res*l)%Mod;
		}
	}
//	Rep(i,0,n+n)Rep(j,1,n)cerr<<g[i][j][0]<<" \n"[j==n];
	f[0][0][0]=1;
	Rep(i,0,n-1){
		Rep(j,0,i){
			Rep(s,0,2*i)if(f[i][j][s]){
				Rep(k,1,n-i){
					f[i+k][j+1][s+k]=(f[i+k][j+1][s+k]+1LL*f[i][j][s]*g[s][k][0]%Mod*k%Mod*(k-1)%Mod*inv4)%Mod;

					f[i+k][j+1][s+k+1]=(f[i+k][j+1][s+k+1]+1LL*f[i][j][s]*g[s][k][1])%Mod;
					f[i+k][j+1][s+k+1]=(f[i+k][j+1][s+k+1]-1LL*f[i][j][s]*g[s][k][2])%Mod;
					f[i+k][j+1][s+k]=(f[i+k][j+1][s+k]+1LL*f[i][j][s]*k%Mod*(k+1)%Mod*inv[2]%Mod*g[s][k][0])%Mod;
				}
			}
		}
	}
	Rep(i,1,n)Rep(j,1,n)Rep(k,1,2*i)ans[i][j]=(ans[i][j]+f[i][j][k])%Mod;
	cerr<<"Ok"<<"\n";
}

void solve(){
	cin>>n>>K;
	cout<<1LL*(ans[n][K]%Mod+Mod)%Mod*fac[n]%Mod<<"\n";
}

int tex;
int main (){
	fre(permutation);
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);cin>>Mod;cin>>tex;InitC();DP();while(tex--)solve(); 
}
posted @ 2023-02-12 21:08  Delov  阅读(30)  评论(0编辑  收藏  举报