QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#142312#4917. 中奖率pzr0 1ms3952kbC++171.8kb2023-08-18 22:35:402023-08-18 22:35:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-18 22:35:50]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3952kb
  • [2023-08-18 22:35:40]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define p 1000000009
#define N 130
#define w3 115381398ll
using namespace std;
int n,m,x,y,bz[N];
ll c[N][N],f[N][N],a[N][N],g[N][N],k,h[N][N][N];
void add(ll &x,ll y){x+=y;if(x>=p)x-=p;}
void solve(ll w){
	memset(g,0,sizeof(g));
	for(int i=0;i<=n;i++){ll v=w*w%p;
		memset(f,0,sizeof(f));f[0][0]=1;
		for(int j=1;j<=n-i;j++)
		for(int x=n;x>=0;x--)
		for(int y=n-x;y>=0;y--){
			if(x)add(f[x][y],f[x-1][y]);
			if(y)add(f[x][y],f[x][y-1]);
		}
		for(int j=1;j<=i;j++)
		for(int x=n;x>=0;x--)
		for(int y=n-x;y>=0;y--){
			if(x)f[x][y]=(f[x][y]+f[x-1][y]*w);
			if(y)f[x][y]=(f[x][y]+f[x][y-1]*v);
			f[x][y]%=p;
		}
		for(int x=0;x<=n;x++)
		for(int y=0;y<=n-x;y++)
		add(g[i][0],1ll*a[x][y]*f[x][y]%p);
		for(int j=1;j<=n-i;j++){
			for(int x=n;x>=0;x--)
			for(int y=n-x;y>=0;y--){
				if(x)f[x][y]+=f[x-1][y]*v;
				if(y)f[x][y]+=f[x][y-1]*w;
				f[x][y]%=p;
			}
			for(int x=0;x<=n;x++)
			for(int y=0;y<=n-x;y++){
				if(x)add(f[x][y],p-f[x-1][y]);
				if(y)add(f[x][y],p-f[x][y-1]);
			}
			for(int x=0;x<=n;x++)
			for(int y=0;y<=n-x;y++)
			g[i][j]=(g[i][j]+a[x][y]*f[x][y])%p;
		}
	}
}
ll qpow(ll x,ll v){
	ll y=1;
	while(v){
		if(v&1)y=y*x%p;
		x=x*x%p;v>>=1;
	}return y;
}
int main(){
//	freopen("machine.in","r",stdin);
//	freopen("machine.out","w",stdout);
	scanf("%d%d%lld",&n,&m,&k);
	for(int i=0;i<=n;i++){
		c[i][0]=1;
		for(int j=1;j<=i;j++)
		c[i][j]=(c[i-1][j]+c[i-1][j-1])%p;
	}
	for(int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		a[x][y]++;
	}
	solve(w3);
	for(int i=0;i<=n;i++)
	for(int j=0;j<=n-i;j++)
	a[i][j]=qpow(g[i][j],k%(p-1));
	solve(1ll*w3*w3%p);
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n-i;j++){
			g[i][j]=1ll*g[i][j]*qpow(qpow(3,n),p-2)%p*c[n][i]%p*c[n-i][j]%p;
			printf("%lld ",g[i][j]);
		}printf("\n");
	}
}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

93594 19
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3952kb

input:

10 19
0000000000
2 241
1 405
1 927
1 669
1 734
1 349
2 493
1 828
1 385
1 855
2 761
1 63
1 288
1 754
2 91
1 863
2 805
2 1000
1 1000

output:

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 

result:

wrong answer 1st words differ - expected: '241', found: '1'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Runtime Error

Test #26:

score: 0
Runtime Error

input:

91666 20
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #5:

score: 0
Runtime Error

Test #36:

score: 0
Runtime Error

input:

98506 19
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%