QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#473982#2568. MountainsczcWA 0ms3920kbC++231.0kb2024-07-12 15:22:282024-07-12 15:22:29

Judging History

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

  • [2024-07-12 15:22:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3920kb
  • [2024-07-12 15:22:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn=105;
int n,m,k;
const int mod=1e9+7;
#define ll long long 
int a[maxn][maxn];
int c[maxn<<2][maxn<<2];
inline int h(int x,int y,int x2,int y2){
	if(x-x2<0 || y2-y<0) return 0;
	return c[x-x2+y2-y][x-x2];
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	c[0][0]=c[1][0]=c[1][1]=1;
	for(int i=2;i<=max(n,m)*4;i++){
		c[i][0]=1;
		for(int j=1;j<=i;j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	} 
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			a[i][j]=h(n+i-1,i-1,j-1,m+j-1);
		}
	}
	int f=1;
	for(int i=1;i<=k;i++){
		for(int j=i;j<=k;j++){
			if(a[j][i]){
				swap(a[j],a[i]);
				if(i!=j) f*=-1;
			}
		}
		if(!a[i][i]){
			puts("0");
			return 0;
		}
		for(int j=i+1;j<=k;j++){
			while(1){
				int delta=a[j][i]/a[i][i];
				for(int l=1;l<=k;l++) a[j][l]=(a[j][l]-(ll)delta*a[i][l]%mod+mod)%mod;
				if(!a[j][i]) break;
				swap(a[j],a[i]);
				f*=-1;
			}
		}
	}
	for(int i=1;i<=k;i++) f=(ll)f*a[i][i]%mod;
	printf("%d",f);
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3716kb

input:

1 1 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

2 2 2

output:

20

result:

ok 1 number(s): "20"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

2 3 4

output:

490

result:

ok 1 number(s): "490"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3792kb

input:

1 2 8

output:

-999999962

result:

wrong answer 1st numbers differ - expected: '45', found: '-999999962'