QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#346308#7648. 网格图最大流计数Crysfly100 ✓2041ms16512kbC++176.3kb2024-03-08 10:38:592024-03-08 10:39:00

Judging History

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

  • [2024-03-08 10:39:00]
  • 评测
  • 测评结果:100
  • 用时:2041ms
  • 内存:16512kb
  • [2024-03-08 10:38:59]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 1000000007
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 1005
#define inf 0x3f3f3f3f

#define poly vector<modint>

template<class T>
poly Char(int n,T a){
	static modint f[1005][1005];
	For(i,1,n-1){
		int p=-1;
		For(j,i+1,n)
			if(a[j][i].x){p=j;break;}
		if(p==-1)continue;
		else if(p!=i+1){
			For(j,1,n)swap(a[p][j],a[i+1][j]);
			For(j,1,n)swap(a[j][p],a[j][i+1]);
		}
		For(j,i+2,n){
			modint tmp=a[j][i]/a[i+1][i];
			For(k,1,n)a[j][k]-=tmp*a[i+1][k];
			For(k,1,n)a[k][i+1]+=tmp*a[k][j];
		}
	}
	f[0][0]=1;
	For(i,1,n){
		For(j,0,n)f[i][j]=0;
		For(j,1,i-1){
			modint tmp=a[j][i];
			For(k,j,i-1)tmp*=a[k+1][k];
			For(k,0,i)f[i][k]-=tmp*f[j-1][k];
		}
		For(j,1,n)f[i][j]+=f[i-1][j-1];
		For(j,0,n)f[i][j]-=a[i][i]*f[i-1][j];
	}
	return poly(f[n],f[n]+n+1);
}

template<class T>
modint det(int n,T a){
	modint res=1;
	For(j,1,n){
		For(i,j,n)
			if(a[i][j].x){
				if(i!=j){
					res=-res;
					For(k,1,n)swap(a[i][k],a[j][k]);
				}
				break;
			}
		if(!a[j][j].x)return 0;
		res*=a[j][j];
		modint iv=1/a[j][j];
		For(i,j+1,n){
			modint tmp=a[i][j]*iv;
			For(k,j,n)a[i][k]-=a[j][k]*tmp;
		}
	}
	return res;
}

template<class T>
modint pf(int n,T a){
	modint res=1;
	for(int i=1;i<=n;i+=2){
		if(!a[i][i+1].x){
			int k=i+1;
			while(k<=n && !a[i][k].x)++k;
			if(k>n)return 0;
			swap(a[i][i+1],a[i][k]);
			For(j,k+1,n)swap(a[i+1][j],a[k][j]);
			For(j,i+2,k-1)swap(a[i+1][j],a[j][k]),a[j][k]=-a[j][k],a[i+1][j]=-a[i+1][j];
			a[i+1][k]=-a[i+1][k];
			res=-res;
		}
		res*=a[i][i+1];
		modint I=1/a[i][i+1];
		For(j,i+2,n){
			modint r=a[i][j]*I;
			For(k,j+1,n)a[j][k]-=r*a[i+1][k];
			For(k,i+2,j-1)a[k][j]+=r*a[i+1][k];
		}
	}
	return res;
}

template<class T>
poly detpoly(int n,int d,T a){
	static modint b[1005][1005];
	int out=0;
	modint coe=1;
	For(i,1,n){
		while(!a[d][i][i].x){
			For(j,i+1,n)if(a[d][i][j].x){
				coe=-coe;
				For(e,0,d)For(k,1,n)swap(a[e][k][i],a[e][k][j]);
				break;
			}
			if(a[d][i][i].x)break;
			++out;
			if(out>n*d+1)return poly(n*d+1,0);
			Rep(e,d,1)For(j,1,n)a[e][i][j]=a[e-1][i][j];
			For(j,1,n)a[0][i][j]=0;
			For(j,1,i-1){
				modint z=-a[d][i][j];
				For(e,0,d) For(k,1,n) a[e][i][k]+=a[e][j][k]*z;
			}
		}
		coe*=a[d][i][i];
		modint I=1/a[d][i][i];
		For(e,0,d)For(j,1,n) if(a[e][i][j].x) a[e][i][j]*=I;
		For(j,1,n)if(i!=j && a[d][j][i].x){
			modint t=a[d][j][i];
			For(e,0,d) For(k,1,n) if(a[e][i][k].x) a[e][j][k]-=t*a[e][i][k];
		}
	}
	For(i,1,n*(d-1))b[i][n+i]=1;
	For(e,0,d-1)For(i,1,n)For(j,1,n)
		b[n*(d-1)+i][n*e+j]=-a[e][i][j];
	poly fs=Char(n*d,b);
	poly f(n*d+1,0);
	For(i,0,n*d-out)f[i]=coe*fs[i+out];
	return f;
}

int n,m,k,a[maxn],b[maxn];
char s[405][405];
modint f[405][405],go[405][405],sum[405][405];
modint mat[3][405][405],g[405][405];
modint res[405];

signed main()
{
	n=read(),m=read(),k=read();
	For(i,1,n)a[i]=read();
	For(i,1,m)b[i]=read();
	For(i,1,k)scanf("%s",s[i]+1);
	
	For(i,1,n){
		memset(f,0,sizeof f);
		f[1][a[i]]=1;
		For(x,1,k)For(y,1,k)
			if(s[x][y]=='1')f[x+1][y]+=f[x][y],f[x][y+1]+=f[x][y];
			else f[x][y]=0;
		For(j,1,m) go[i][j]=f[k][b[j]];
	}
//	if(n%2) ++n,++m,go[n][m]=1;
	For(i,1,n)For(j,1,m)sum[i][j]=sum[i][j-1]+go[i][j];
	For(i,1,n)For(j,i+1,n){
		For(k,1,m){
			modint t=sum[i][k]*go[j][k]-sum[j][k]*go[i][k];
			g[i][j]+=t;
			g[j][i]-=t;
		}
	}
	//For(i,1,n)For(j,1,n)cout<<mat[i][j].x<<" \n"[j==n];
	
	int len=(n%2==0?n+2:n+1);
	For(i,1,len) For(j,i+1,len) {
		mat[0][i][j]+=sign(j-i-1);
		if(i<=n && j<=n) mat[2][i][j]=g[i][j];
	}
	For(i,1,n) mat[1][i][len]=sum[i][m];
	For(d,0,2) For(i,1,len) For(j,i+1,len) mat[d][j][i]=-mat[d][i][j];
	
//	For(d,0,2){
//		For(i,1,len)For(j,1,len)cout<<mat[d][i][j].x<<" \n"[j==len];
//		puts("-----------");
//	}
	poly ans=detpoly(len,2,mat);
//	for(auto x:ans)cout<<x.x<<" "; cout<<"\n";
	res[0]=1;
	For(i,1,n){
		res[i]=ans[i];
		For(j,1,i-1)res[i]-=res[j]*res[i-j];
		res[i]*=((mod+1)/2);
	}
	Rep(i,n,0)
		if(res[i].x){
			cout<<i<<" "<<res[i].x<<"\n";
			exit(0);
		}
	return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 4ms
memory: 16508kb

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: 4ms
memory: 16228kb

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: 0ms
memory: 16284kb

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: 0ms
memory: 16144kb

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: 16276kb

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: 0ms
memory: 16204kb

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: 16164kb

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: 16204kb

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: 16280kb

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: 5ms
memory: 16256kb

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: 3ms
memory: 16164kb

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: 4ms
memory: 16512kb

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: 3ms
memory: 16284kb

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: 16200kb

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: 9ms
memory: 16164kb

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: 6ms
memory: 16144kb

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: 5ms
memory: 16492kb

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: 16164kb

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: 3ms
memory: 16500kb

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: 3ms
memory: 16492kb

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: 77ms
memory: 16212kb

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: 82ms
memory: 16144kb

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: 86ms
memory: 16204kb

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: 78ms
memory: 16164kb

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: 77ms
memory: 16144kb

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: 75ms
memory: 16496kb

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: 83ms
memory: 16284kb

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: 79ms
memory: 16456kb

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: 78ms
memory: 16460kb

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: 87ms
memory: 16184kb

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: 46ms
memory: 16440kb

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: 46ms
memory: 16284kb

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: 55ms
memory: 16508kb

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: 46ms
memory: 16512kb

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: 48ms
memory: 16180kb

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: 339ms
memory: 16216kb

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: 458ms
memory: 16152kb

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: 649ms
memory: 16464kb

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: 874ms
memory: 16212kb

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: 1090ms
memory: 16208kb

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: 94ms
memory: 16200kb

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: 80ms
memory: 16284kb

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: 88ms
memory: 16144kb

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: 90ms
memory: 16160kb

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: 101ms
memory: 16224kb

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: 343ms
memory: 16224kb

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: 498ms
memory: 16448kb

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: 640ms
memory: 16508kb

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: 897ms
memory: 16208kb

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: 1097ms
memory: 16284kb

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: 1352ms
memory: 16276kb

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: 1558ms
memory: 16212kb

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: 1739ms
memory: 16512kb

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: 1794ms
memory: 16232kb

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: 1426ms
memory: 16232kb

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: 1931ms
memory: 16444kb

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: 1742ms
memory: 16208kb

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: 1960ms
memory: 16284kb

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: 2041ms
memory: 16288kb

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: 1269ms
memory: 16204kb

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