QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#317319#7648. 网格图最大流计数JohnAlfnov100 ✓1264ms13076kbC++203.9kb2024-01-28 20:29:532024-01-28 20:29:55

Judging History

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

  • [2024-01-28 20:29:55]
  • 评测
  • 测评结果:100
  • 用时:1264ms
  • 内存:13076kb
  • [2024-01-28 20:29:53]
  • 提交

answer

//Code by Lightningfall
//Start coding on ????/??/??
//Finish debugging on ????/??/??
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int powdv(int x,int y=mod-2){
	int ans=1;
	while(y){
		if(y&1)ans=1ll*ans*x%mod;
		y>>=1,x=1ll*x*x%mod;
	}
	return ans;
}
int n,m,k;
int a[405],b[405];
char s[405][405];
int d[405][405],f[405][405];
int a1[405],a2[405],z[405][405];
int A[405][405],B[405][405],C[405][405];
int c[805][805],p[805][805];
int pp[805],q[805];
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	for(int i=1;i<=m;++i)scanf("%d",&b[i]);
	for(int i=1;i<=k;++i)scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=k;++j)for(int l=1;l<=k;++l){
			f[j][l]=0;
		}
		if(s[1][a[i]]=='1')f[1][a[i]]=1;
		for(int j=1;j<=k;++j)for(int l=1;l<=k;++l)if(f[j][l]){
			if(s[j+1][l]=='1')f[j+1][l]=(f[j+1][l]+f[j][l])%mod;
			if(s[j][l+1]=='1')f[j][l+1]=(f[j][l+1]+f[j][l])%mod;
		}
		for(int j=1;j<=m;++j){
			d[i][j]=f[k][b[j]];
		}
	}
	d[++n][++m]=1;
	for(int i=1;i<n;++i)for(int j=i+1;j<=n;++j){
		for(int l=1;l<=m;++l)a1[l]=d[i][l],a2[l]=d[j][l];
		int h1=0,h2=0,zz=0;
		for(int l=m;l>=1;--l){
			zz=(zz+1ll*a1[l]*h2-1ll*a2[l]*h1)%mod;
			h1=(h1+a1[l])%mod,h2=(h2+a2[l])%mod;
		}
		z[i][j]=(zz+mod)%mod,z[j][i]=(-zz+mod)%mod;
	}
	int ls=n;
	if(n&1)++n;
	for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j){
		A[i][j]=(i+j+1)%2==1?-1:1;
		if(j==ls)B[i][j]=z[i][j];
		else if(j<ls)C[i][j]=z[i][j];
		A[j][i]=-A[i][j],B[j][i]=-B[i][j],C[j][i]=-C[i][j];
	}
	int gs=0,r=1;
	for(int i=1;i<=n;++i){
		while(!C[i][i]){
			for(int j=i+1;j<=n;++j)if(C[j][i]){
				for(int k=1;k<=n;++k){
					swap(A[j][k],A[i][k]);
					swap(B[j][k],B[i][k]);
					swap(C[j][k],C[i][k]);
				}
				r=-r;
				break;
			}
			if(C[i][i])break;
			for(int j=1;j<=n;++j)
				C[j][i]=B[j][i],B[j][i]=A[j][i],A[j][i]=0;
			++gs;
			for(int j=1;j<i;++j){
				int zz=-C[j][i];
				for(int k=1;k<=n;++k){
					A[k][i]=(A[k][i]+1ll*zz*A[k][j])%mod;
					B[k][i]=(B[k][i]+1ll*zz*B[k][j])%mod;
					C[k][i]=(C[k][i]+1ll*zz*C[k][j])%mod;
				}
			}
		}
		r=1ll*r*C[i][i]%mod;
		int ny=powdv(C[i][i]);
		for(int j=1;j<=n;++j){
			A[i][j]=1ll*A[i][j]*ny%mod;
			B[i][j]=1ll*B[i][j]*ny%mod;
			C[i][j]=1ll*C[i][j]*ny%mod;
		}
		for(int j=i+1;j<=n;++j){
			int zz=-C[j][i];
			for(int k=1;k<=n;++k){
				A[j][k]=(A[j][k]+1ll*zz*A[i][k])%mod;
				B[j][k]=(B[j][k]+1ll*zz*B[i][k])%mod;
				C[j][k]=(C[j][k]+1ll*zz*C[i][k])%mod;
			}
		}
		for(int j=i+1;j<=n;++j){
			int zz=-C[i][j];
			for(int k=1;k<=n;++k){
				A[k][j]=(A[k][j]+1ll*zz*A[k][i])%mod;
				B[k][j]=(B[k][j]+1ll*zz*B[k][i])%mod;
				C[k][j]=(C[k][j]+1ll*zz*C[k][i])%mod;
			}
		}
	}
	for(int i=n+1;i<=2*n;++i)c[i-n][i]=1;
	for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)
		c[i+n][j]=-A[i][j],c[i+n][j+n]=-B[i][j];
	for(int i=1;i<=2*n-1;++i){
		if(!c[i+1][i]){
			for(int j=i+2;j<=2*n;++j)if(c[j][i]){
				for(int k=1;k<=2*n;++k)swap(c[i+1][k],c[j][k]);
				for(int k=1;k<=2*n;++k)swap(c[k][i+1],c[k][j]);
				break;
			}
		}
		if(!c[i+1][i])continue;
		int ny=powdv(c[i+1][i]);
		for(int j=i+2;j<=2*n;++j)if(c[j][i]){
			int zz=-1ll*ny*c[j][i]%mod;
			for(int k=1;k<=2*n;++k)c[j][k]=(c[j][k]+1ll*zz*c[i+1][k])%mod;
			for(int k=1;k<=2*n;++k)c[k][i+1]=(c[k][i+1]-1ll*zz*c[k][j])%mod;
		}
	}
	p[0][0]=1;
	for(int i=1;i<=2*n;++i){
		for(int j=0;j<i;++j)p[i][j]=p[i-1][j];
		for(int j=i-1;j>=0;--j){
			p[i][j+1]=(p[i][j+1]+p[i][j])%mod;
			p[i][j]=-1ll*p[i][j]*c[i][i]%mod;
		}
		int xs=c[i][i-1];
		for(int j=i-1;j>=1;--j){
			int tt=-1ll*xs*c[j][i]%mod;
			for(int l=0;l<j;++l)p[i][l]=(p[i][l]+1ll*tt*p[j-1][l])%mod;
			xs=1ll*xs*c[j][j-1]%mod;
		}
	}
	int s=2*n-gs;
	for(int i=0;i<=s;++i)pp[i]=(1ll*r*p[2*n][i+gs]%mod+mod)%mod;
	q[0]=1;
	for(int i=1;i<=s/2;++i){
		int zz=pp[i];
		for(int j=1;j<=i-1;++j)zz=(zz-1ll*q[j]*q[i-j])%mod;
		q[i]=1ll*(mod+1)/2*(zz+mod)%mod;
	}
	printf("%d %d\n",s/2,q[s/2]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 2ms
memory: 10200kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #2:

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

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 10168kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #4:

score: 0
Accepted
time: 1ms
memory: 10156kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1110111
1111111

output:

6 52

result:

ok 2 number(s): "6 52"

Test #5:

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

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1110111
1111111

output:

6 52

result:

ok 2 number(s): "6 52"

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #6:

score: 5
Accepted
time: 2ms
memory: 10260kb

input:

16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111011111111111111
111111111111111111
111111111111111111
111011110111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
1...

output:

14 328354990

result:

ok 2 number(s): "14 328354990"

Test #7:

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

input:

17 16 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111101111111111
111111111111111111
111111111111011111
...

output:

15 449998848

result:

ok 2 number(s): "15 449998848"

Test #8:

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

input:

16 18 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
111111111111110111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111110111111
111111111111111111
11111111111111111...

output:

15 844316215

result:

ok 2 number(s): "15 844316215"

Test #9:

score: 0
Accepted
time: 2ms
memory: 10292kb

input:

16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111011111111110111
111111111111111111
111111111111111111
111011111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
1...

output:

15 133840

result:

ok 2 number(s): "15 133840"

Test #10:

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

input:

18 18 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111011111111
111111111111111111
111101111111111111
111111111111111111
11111111111...

output:

16 27330297

result:

ok 2 number(s): "16 27330297"

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 10
Accepted
time: 10ms
memory: 10560kb

input:

10 377 400
1 2 3 4 5 6 7 8 9 10
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

10 843273461

result:

ok 2 number(s): "10 843273461"

Test #12:

score: 0
Accepted
time: 10ms
memory: 10908kb

input:

10 367 400
1 2 3 4 5 6 7 8 9 10
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104...

output:

10 273577493

result:

ok 2 number(s): "10 273577493"

Test #13:

score: 0
Accepted
time: 6ms
memory: 10204kb

input:

10 350 400
1 2 3 4 5 6 7 8 9 10
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 11...

output:

9 605707862

result:

ok 2 number(s): "9 605707862"

Test #14:

score: 0
Accepted
time: 6ms
memory: 10984kb

input:

10 375 400
1 2 3 4 5 6 7 8 9 10
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

10 213051017

result:

ok 2 number(s): "10 213051017"

Test #15:

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

input:

10 330 400
1 2 3 4 5 6 7 8 9 10
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ...

output:

9 320097125

result:

ok 2 number(s): "9 320097125"

Test #16:

score: 0
Accepted
time: 10ms
memory: 10556kb

input:

10 360 400
1 2 3 4 5 6 7 8 9 10
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107...

output:

10 195548453

result:

ok 2 number(s): "10 195548453"

Test #17:

score: 0
Accepted
time: 10ms
memory: 8820kb

input:

10 365 400
1 2 3 4 5 6 7 8 9 10
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 10...

output:

10 20617593

result:

ok 2 number(s): "10 20617593"

Test #18:

score: 0
Accepted
time: 6ms
memory: 10948kb

input:

10 334 400
1 2 3 4 5 6 7 8 9 10
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 11...

output:

10 602177426

result:

ok 2 number(s): "10 602177426"

Test #19:

score: 0
Accepted
time: 6ms
memory: 11008kb

input:

10 323 400
1 2 3 4 5 6 7 8 9 10
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 1...

output:

9 619229914

result:

ok 2 number(s): "9 619229914"

Test #20:

score: 0
Accepted
time: 6ms
memory: 10992kb

input:

10 379 400
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...

output:

10 409116219

result:

ok 2 number(s): "10 409116219"

Subtask #4:

score: 25
Accepted

Dependency #3:

100%
Accepted

Test #21:

score: 25
Accepted
time: 95ms
memory: 11720kb

input:

100 322 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

85 207066474

result:

ok 2 number(s): "85 207066474"

Test #22:

score: 0
Accepted
time: 93ms
memory: 11588kb

input:

100 334 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

84 608992198

result:

ok 2 number(s): "84 608992198"

Test #23:

score: 0
Accepted
time: 97ms
memory: 11208kb

input:

100 373 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

87 22076236

result:

ok 2 number(s): "87 22076236"

Test #24:

score: 0
Accepted
time: 97ms
memory: 11812kb

input:

100 327 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

87 819624712

result:

ok 2 number(s): "87 819624712"

Test #25:

score: 0
Accepted
time: 94ms
memory: 11312kb

input:

100 326 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

89 339092727

result:

ok 2 number(s): "89 339092727"

Test #26:

score: 0
Accepted
time: 93ms
memory: 11576kb

input:

100 366 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

87 577188664

result:

ok 2 number(s): "87 577188664"

Test #27:

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

input:

100 394 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

86 909840591

result:

ok 2 number(s): "86 909840591"

Test #28:

score: 0
Accepted
time: 97ms
memory: 11628kb

input:

100 389 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

87 793712350

result:

ok 2 number(s): "87 793712350"

Test #29:

score: 0
Accepted
time: 97ms
memory: 11720kb

input:

100 334 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

89 8486281

result:

ok 2 number(s): "89 8486281"

Test #30:

score: 0
Accepted
time: 97ms
memory: 11700kb

input:

100 367 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

87 419573333

result:

ok 2 number(s): "87 419573333"

Subtask #5:

score: 10
Accepted

Test #31:

score: 10
Accepted
time: 64ms
memory: 11416kb

input:

73 73 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 ...

output:

73 849796347

result:

ok 2 number(s): "73 849796347"

Test #32:

score: 0
Accepted
time: 60ms
memory: 11328kb

input:

68 68 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...

output:

68 334069950

result:

ok 2 number(s): "68 334069950"

Test #33:

score: 0
Accepted
time: 64ms
memory: 11084kb

input:

72 72 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133...

output:

72 180096245

result:

ok 2 number(s): "72 180096245"

Test #34:

score: 0
Accepted
time: 59ms
memory: 12760kb

input:

71 71 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 13...

output:

71 234343448

result:

ok 2 number(s): "71 234343448"

Test #35:

score: 0
Accepted
time: 60ms
memory: 11312kb

input:

68 68 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...

output:

68 371509898

result:

ok 2 number(s): "68 371509898"

Test #36:

score: 0
Accepted
time: 284ms
memory: 12500kb

input:

200 200 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

200 852372194

result:

ok 2 number(s): "200 852372194"

Test #37:

score: 0
Accepted
time: 378ms
memory: 12468kb

input:

230 230 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

230 65874836

result:

ok 2 number(s): "230 65874836"

Test #38:

score: 0
Accepted
time: 493ms
memory: 12560kb

input:

260 260 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

260 272563656

result:

ok 2 number(s): "260 272563656"

Test #39:

score: 0
Accepted
time: 635ms
memory: 12900kb

input:

290 290 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

290 95450701

result:

ok 2 number(s): "290 95450701"

Test #40:

score: 0
Accepted
time: 807ms
memory: 12768kb

input:

320 320 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

320 266455174

result:

ok 2 number(s): "320 266455174"

Subtask #6:

score: 25
Accepted

Dependency #5:

100%
Accepted

Test #41:

score: 25
Accepted
time: 105ms
memory: 11804kb

input:

107 371 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

107 3979643

result:

ok 2 number(s): "107 3979643"

Test #42:

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

input:

101 351 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 372994325

result:

ok 2 number(s): "101 372994325"

Test #43:

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

input:

101 369 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 46156842

result:

ok 2 number(s): "101 46156842"

Test #44:

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

input:

101 386 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 634357614

result:

ok 2 number(s): "101 634357614"

Test #45:

score: 0
Accepted
time: 112ms
memory: 11696kb

input:

109 388 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

109 24613754

result:

ok 2 number(s): "109 24613754"

Test #46:

score: 0
Accepted
time: 301ms
memory: 11876kb

input:

200 399 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

200 342259639

result:

ok 2 number(s): "200 342259639"

Test #47:

score: 0
Accepted
time: 393ms
memory: 12948kb

input:

230 393 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

230 596706635

result:

ok 2 number(s): "230 596706635"

Test #48:

score: 0
Accepted
time: 514ms
memory: 12944kb

input:

260 393 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

260 569883617

result:

ok 2 number(s): "260 569883617"

Test #49:

score: 0
Accepted
time: 647ms
memory: 13076kb

input:

290 395 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

290 473037952

result:

ok 2 number(s): "290 473037952"

Test #50:

score: 0
Accepted
time: 827ms
memory: 12732kb

input:

320 397 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

320 375576485

result:

ok 2 number(s): "320 375576485"

Subtask #7:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #51:

score: 20
Accepted
time: 858ms
memory: 13032kb

input:

400 375 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

0 1

result:

ok 2 number(s): "0 1"

Test #52:

score: 0
Accepted
time: 1039ms
memory: 12884kb

input:

400 346 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

44 259349435

result:

ok 2 number(s): "44 259349435"

Test #53:

score: 0
Accepted
time: 1126ms
memory: 12948kb

input:

400 368 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

92 934744081

result:

ok 2 number(s): "92 934744081"

Test #54:

score: 0
Accepted
time: 1163ms
memory: 12964kb

input:

400 331 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

118 819815069

result:

ok 2 number(s): "118 819815069"

Test #55:

score: 0
Accepted
time: 903ms
memory: 12956kb

input:

355 385 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

154 827736761

result:

ok 2 number(s): "154 827736761"

Test #56:

score: 0
Accepted
time: 1232ms
memory: 13028kb

input:

400 380 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

165 936566720

result:

ok 2 number(s): "165 936566720"

Test #57:

score: 0
Accepted
time: 1107ms
memory: 12916kb

input:

382 335 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

164 615816056

result:

ok 2 number(s): "164 615816056"

Test #58:

score: 0
Accepted
time: 1241ms
memory: 12972kb

input:

400 324 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

180 258747176

result:

ok 2 number(s): "180 258747176"

Test #59:

score: 0
Accepted
time: 1264ms
memory: 12940kb

input:

400 326 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

191 245039016

result:

ok 2 number(s): "191 245039016"

Test #60:

score: 0
Accepted
time: 815ms
memory: 12748kb

input:

333 388 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

212 219763298

result:

ok 2 number(s): "212 219763298"

Extra Test:

score: 0
Extra Test Passed