QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#480484#2568. MountainszTL 360ms4304kbC++141.1kb2024-07-16 16:03:512024-07-16 16:03:51

Judging History

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

  • [2024-07-16 16:03:51]
  • 评测
  • 测评结果:TL
  • 用时:360ms
  • 内存:4304kb
  • [2024-07-16 16:03:51]
  • 提交

answer

/*
设 a_{i,j} 为到达每个点的最大路径和,那么会出现 0-k-1 的 k 条不相交轮廓线
注意可以在边缘上交,向右下平移后转化为 LGV 引理模板题 
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
int n,m,k;
ll f[205][205];
ll a[105][105];
ll dp(int A,int B,int C,int D){
	for(int i=1;i<=n+k;i++)
		for(int j=1;j<=m+i&&j<=m+k;j++)
			f[i][j]=0;
	f[A][B]=1;
	for(int i=n+k;i>=1;i--)
		for(int j=max(1,i-n);j<=m+i&&j<=m+k;j++){
			if(i==A&&j==B) continue;
			f[i][j]=(f[i+1][j]+f[i][j-1])%MOD;
		}
	return f[C][D];
}
ll Gauss(){
	ll ret=1,f=1;
	for(int i=0;i<k;i++){
		for(int j=i+1;j<k;j++){
			while(a[i][i]){
				ll tmp=a[j][i]/a[i][i];
				for(int t=i;t<k;t++)
					(a[j][t]+=MOD-tmp*a[i][t]%MOD)%=MOD;
				swap(a[i],a[j]);
				f=-f;
			}
			swap(a[i],a[j]);
			f=-f;
		}
		(ret*=a[i][i])%=MOD;
	}
	return (ret*f+MOD)%MOD; 
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<k;i++){
		for(int j=0;j<k;j++){
			a[i][j]=dp(n+i+1,1+i,1+j,m+j+1);
		}
	}
	printf("%lld",Gauss());
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 1 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

2 2 2

output:

20

result:

ok 1 number(s): "20"

Test #3:

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

input:

2 3 4

output:

490

result:

ok 1 number(s): "490"

Test #4:

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

input:

1 2 8

output:

45

result:

ok 1 number(s): "45"

Test #5:

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

input:

1 10 2

output:

66

result:

ok 1 number(s): "66"

Test #6:

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

input:

9 5 7

output:

371850968

result:

ok 1 number(s): "371850968"

Test #7:

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

input:

3 3 1

output:

20

result:

ok 1 number(s): "20"

Test #8:

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

input:

7 7 9

output:

166345303

result:

ok 1 number(s): "166345303"

Test #9:

score: 0
Accepted
time: 5ms
memory: 4032kb

input:

25 15 25

output:

850087558

result:

ok 1 number(s): "850087558"

Test #10:

score: 0
Accepted
time: 283ms
memory: 4180kb

input:

45 59 71

output:

659153227

result:

ok 1 number(s): "659153227"

Test #11:

score: 0
Accepted
time: 7ms
memory: 4088kb

input:

73 3 25

output:

683124269

result:

ok 1 number(s): "683124269"

Test #12:

score: 0
Accepted
time: 135ms
memory: 4168kb

input:

1 48 78

output:

446896916

result:

ok 1 number(s): "446896916"

Test #13:

score: 0
Accepted
time: 37ms
memory: 3904kb

input:

25 100 32

output:

966287506

result:

ok 1 number(s): "966287506"

Test #14:

score: 0
Accepted
time: 96ms
memory: 4016kb

input:

85 64 40

output:

125679545

result:

ok 1 number(s): "125679545"

Test #15:

score: 0
Accepted
time: 76ms
memory: 4212kb

input:

5 9 94

output:

620471576

result:

ok 1 number(s): "620471576"

Test #16:

score: 0
Accepted
time: 48ms
memory: 3884kb

input:

33 57 40

output:

637315057

result:

ok 1 number(s): "637315057"

Test #17:

score: 0
Accepted
time: 360ms
memory: 4304kb

input:

61 6 97

output:

362472796

result:

ok 1 number(s): "362472796"

Test #18:

score: 0
Accepted
time: 158ms
memory: 3992kb

input:

85 50 51

output:

192099209

result:

ok 1 number(s): "192099209"

Test #19:

score: 0
Accepted
time: 267ms
memory: 4032kb

input:

96 54 59

output:

714762612

result:

ok 1 number(s): "714762612"

Test #20:

score: 0
Accepted
time: 3ms
memory: 3996kb

input:

20 99 12

output:

772155662

result:

ok 1 number(s): "772155662"

Test #21:

score: 0
Accepted
time: 150ms
memory: 4144kb

input:

48 39 62

output:

670046604

result:

ok 1 number(s): "670046604"

Test #22:

score: 0
Accepted
time: 13ms
memory: 4104kb

input:

76 83 16

output:

976820079

result:

ok 1 number(s): "976820079"

Test #23:

score: 0
Accepted
time: 232ms
memory: 4276kb

input:

96 36 61

output:

20854557

result:

ok 1 number(s): "20854557"

Test #24:

score: 0
Accepted
time: 173ms
memory: 4156kb

input:

18 40 77

output:

261684871

result:

ok 1 number(s): "261684871"

Test #25:

score: 0
Accepted
time: 25ms
memory: 4064kb

input:

42 84 26

output:

458573307

result:

ok 1 number(s): "458573307"

Test #26:

score: 0
Accepted
time: 334ms
memory: 4288kb

input:

71 25 80

output:

875902815

result:

ok 1 number(s): "875902815"

Test #27:

score: 0
Accepted
time: 42ms
memory: 4136kb

input:

95 73 26

output:

922299967

result:

ok 1 number(s): "922299967"

Test #28:

score: 0
Accepted
time: 137ms
memory: 4084kb

input:

19 17 83

output:

494148696

result:

ok 1 number(s): "494148696"

Test #29:

score: -100
Time Limit Exceeded

input:

100 100 100

output:


result: