QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#267794#6611. United in StormwindCrysflyAC ✓124ms11288kbC++173.0kb2023-11-27 18:38:322023-11-27 18:38:32

Judging History

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

  • [2023-11-27 18:38:32]
  • 评测
  • 测评结果:AC
  • 用时:124ms
  • 内存:11288kb
  • [2023-11-27 18:38:32]
  • 提交

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 ull unsigned long long
#define int long long
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 998244353
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 2000005
#define inf 0x3f3f3f3f

int n,m,k;
void XOR(vector<int>&f,int x)
{
	int n=f.size();
	for(int l=2,k=1;l<=n;l<<=1,k<<=1)
		for(int i=0;i<n;i+=l)
			for(int j=0;j<k;++j){
				int a=f[i|j],b=f[i|j|k];
				f[i|j]=(a+b),f[i|j|k]=(a-b);
			}
	if(x==-1){
		for(auto&x:f)x/=n;
	}
}

int get(){
	string s;
	cin>>s;
	int res=0;
	for(auto c:s)res=res*2+(c=='B');
	return res;
}

signed main()
{
	n=read(),m=read(),k=read();
	vi f; f.resize(1<<m);
	For(i,1,n){
		int s=get();
		++f[s];
	}
	XOR(f,1);
	For(i,0,(1<<m)-1)f[i]*=f[i];
	XOR(f,-1);
	For(i,0,(1<<m)-1)f[i]/=2;
	For(i,0,m-1)
		For(j,0,(1<<m)-1)
			if(j>>i&1)f[j]+=f[j^(1<<i)];
	int res=0;
	For(i,1,(1<<m)-1)
		if(f[(1<<m)-1]-f[(1<<m)-1-i]>=k)++res;
	cout<<res;
	return 0;
}
/*
4 4
1 4 7
4 3 2
2 1 1
1 3 6
*/

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3364kb

input:

2 2 1
AA
BB

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

2 2 1
AA
AB

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

5000 10 12302135
AABAAAABBA
AAABAABBAB
BAABABAAAB
ABBAABBBBA
BAAAAABAAB
BABBAAAAAA
BABBABABAB
BBABBAAAAB
BABBABBBBA
AAAAAAABAA
BBBBBAABBA
BAABABBAAB
BABAAABAAA
AAAAABAABB
BBABAABABB
ABAABBABBA
BBBAAABABA
BAAABABBAB
ABAAAAABAA
AABBBBBBAA
ABBABBABBA
AABBBABBAB
BAABBAAABB
BAAABBBBBB
ABABBAABBB
BABBABBA...

output:

300

result:

ok 1 number(s): "300"

Test #4:

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

input:

5000 10 1
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABB...

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

5000 10 8968133
BABAAAAAAA
BABAAAAAAA
AAABAAAAAA
BABBBBBAAA
AABBAAABAA
AAABAAAAAA
ABAAABAAAB
BABBBBBAAA
BABAAAAAAA
BABBBBBAAA
ABAAABAAAB
BABAAAAAAA
ABAAABAAAB
AABBAAABAA
AAABAAAAAA
BABAAAAAAA
AAABAAAAAA
BABBBBBAAA
BABBBBBAAA
BABAAAAAAA
BABAAAAAAA
AABBAAABAA
AABBAAABAA
AAABAAAAAA
AAABAAAAAA
AAABAAAAA...

output:

886

result:

ok 1 number(s): "886"

Test #6:

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

input:

5000 10 10507302
BBBAABAAAB
BBBAABAAAB
ABAABAAAAA
BBBABBAAAA
ABBABABBAB
ABBABABBAB
BBBABBAAAA
BBBABBAAAA
AABAABBABA
ABBABAAABB
ABBABAAABB
ABAABAAAAA
BBABBABBAB
BAABBAABAA
BAABBBAAAA
BABBBABAAB
ABBABAAABB
BAABBAABAA
BBABBABBAB
BBABBABBAB
ABAABAAAAA
ABBABABBAB
ABAABAAAAA
ABBABAAABB
AABAABBABA
BBABBABB...

output:

755

result:

ok 1 number(s): "755"

Test #7:

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

input:

5000 10 10810288
BBBAAABBBB
BBBBBAAAAB
BBBABAABBB
BBBBABBBBA
BBBBABBBBA
AAAAAABAAA
BBAAABBABB
AAABBABAAB
AAABBBAABB
ABBBBBABBA
ABABABBBBA
AABBABBBAA
AAABAABBAB
BBBAABBBAA
AAABAABBAA
BBAABBBAAA
ABBAABABBB
BBAABBBAAA
BAABBBBABA
BBBBBABABA
AABABABAAA
BABBBBBAAB
BBABBABAAB
AAABAABBAA
BBBBABBBBA
AAABAAAB...

output:

870

result:

ok 1 number(s): "870"

Test #8:

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

input:

5000 10 12280385
ABABAAABBA
ABBBBABBAB
AABBBBAABA
BBBABAABAA
AAAAABABAA
BBBBABAAAA
BBAAAABBBA
ABABBABAAB
ABABAABBAB
BAAABAAAAB
AAAABBBABA
BABBBAABAA
ABBBBBBAAB
ABBBABBABA
BBAABAABAA
ABABBBAABB
ABBBBBAAAB
BBBAABBAAB
BBBBBAABBB
BBBABAABAB
ABAAAAABBB
AAAAABABAA
BBAAAAABBA
BAAABBABAB
BABBBBBABA
ABAAABAB...

output:

141

result:

ok 1 number(s): "141"

Test #9:

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

input:

5000 10 12436636
ABABABAABB
ABAABAAABA
BBBBAAABAB
BABAAABAAB
BBABABAABB
ABAABAAABB
ABBAAAABAB
BAAAABBBBB
ABABAAAABB
BAABAAABBA
AAAAAAABAA
BAAABBABAB
BAAABBBABA
AAAABBBBAA
AABBBAABBA
BBBAAAABAB
BBBBAABBBB
AABABBBBBA
ABABBBAABB
BBAABBABBA
ABAABABABA
BBBBAAABAB
BBBBBAAAAA
AAABABAAAB
ABABAAAAAA
AABBABAB...

output:

28

result:

ok 1 number(s): "28"

Test #10:

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

input:

5000 10 9373047
ABABAAABBB
BABBAABABB
ABABAAAAAB
ABBBAAAABA
ABBBAABABB
AABBBBBABB
AAABAAABAB
ABAABBBBAB
ABAAAABAAB
BBABBBBBAA
AABAAAAABB
BAAAAAAABA
BAABBABBBB
BABAABABBB
ABBBAABABB
ABBAAAAABB
BABBBABBAB
ABAAABABAB
AABBBABAAA
AAABAAAAAB
AABBAABABB
BBBBAAAAAB
AAABBAABBA
ABABABABBB
AABBBBBBAB
AAABAAABB...

output:

999

result:

ok 1 number(s): "999"

Test #11:

score: 0
Accepted
time: 49ms
memory: 11188kb

input:

5000 20 12473302
AAAABBABAABBBABABBAB
ABAABAAAABAABBABBABA
ABBBAABABABABBBAAAAB
BBABABBBAAAAAAABABAA
BAABBBBAABBBBABABBBB
BABBBABBBAAABABAAABB
BAAAABAABBABAABBABBA
ABBAABAAABABABBABBBA
AABAABABAABAABAABBBA
BBBABABAABBAABAAAABA
BBBBBABAAABBBBBABBBB
BBAAAAAAAAABBABBBABA
ABBAAAABABAAAAABBBBB
BBAABBABAB...

output:

635417

result:

ok 1 number(s): "635417"

Test #12:

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

input:

5000 20 1
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBB...

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 47ms
memory: 11224kb

input:

5000 20 9998760
ABABBAABBBABAAAABBAB
BBBABAABAABAAABAAAAA
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
BBBABAABAABAAABAAAAA
ABABBAABBBABAAAABBAB
ABBBBABBBAAAAAAAAABA
ABBBBABBBAAAAAAAAABA
BBBABAABAAB...

output:

1023376

result:

ok 1 number(s): "1023376"

Test #14:

score: 0
Accepted
time: 47ms
memory: 11284kb

input:

5000 20 11247826
BBAAABBABBABAABABAAA
BAABABBAABBBBAAAABBA
AAAAABABAAABAABAABBA
BBBBBABAAABABBBBAAAA
BBBBBABBBABABABBBABA
BBBBBABBBABABABBBABA
BABBAAABBBBAABABAABA
AABBAAABABABAABBBBBA
BBAAABBABBABAABABAAA
BBBABBBAABABBBAAAABB
BAABABAAAABBBABBBBAA
BBBABBBAABABBBAAAABB
BAABABBAABBBBAAAABBA
AABBAAABAB...

output:

929006

result:

ok 1 number(s): "929006"

Test #15:

score: 0
Accepted
time: 47ms
memory: 11220kb

input:

5000 20 12248582
ABABABABABBBAABAAABA
BBBABABABBABBBBBAABA
BAAAAAAABABBBBBBBABB
BAAABAAAAAAAABAABABB
BAABBBAABBABABBBBAAB
BBAABABBBAABBBAAABAA
BABABBABABBBABABABAB
BBBBABBBBAABABBAAAAA
ABBBBBBBBABBABBBBAAB
AABBBBBABBBABBBAAAAA
ABABAAABABBBAABAABBA
BBABABAAABBABAAABABA
BBBBBAABBABBBBBBAAAB
AAABAAABBA...

output:

342770

result:

ok 1 number(s): "342770"

Test #16:

score: 0
Accepted
time: 47ms
memory: 11228kb

input:

5000 20 12315136
ABBBABABBABBAABBBAAA
BAAAABAABAABAABBABAA
BBBABBBBABBBBABBBBAB
AAABAABBAAAABBAAABAB
AABBABBBBAAAABABAAAA
BBABBBBAAABBBBAAABBB
ABAAABAABAAAABABBBAA
BABBBBBABABAAABAABAB
AAABAABABBABBAAAAAAB
ABABBABBAABBBAAABABA
BAABBAAABBBAABABBBAA
BAABBBAAAAAABABBBAAB
AAABABBAAABABBBABBBA
AAABAABBAA...

output:

891051

result:

ok 1 number(s): "891051"

Test #17:

score: 0
Accepted
time: 43ms
memory: 11188kb

input:

5000 20 12460867
AABBABBAAABABABABABA
ABAABBBABAAAABAABABB
ABAABAAABAABABAABAAA
AABABBABBAABABBAABBB
BAABBAABABBABBABBBBA
BBBABABAAABBBAABBABA
BABABBAABBABAAAABABB
BABBBABBBBAABAABBABA
BABABBABAAABBAABABAA
AABAABBBABBAABBABABB
AABBBABBBBABABBAAAAA
BBBBBABBBABBBBBAABBA
ABABAABBAAAAAABAAABB
AABBBABAAA...

output:

487621

result:

ok 1 number(s): "487621"

Test #18:

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

input:

5000 20 12482845
BBBBAABABBBAAAAAABBA
BBBAAAABBABBABBAABAA
BABABBBBBAAAAABBBAAB
AABAAABABAAABBAAABAA
AAAAABAABAAABBAAABBA
ABBBAAABAAAAAAAAAAAB
ABABBABABABBBAAAAAAB
BBABBABABBBAABBBABBA
BBAAABBAAABABBBBAABB
ABBAABABAABBAABABABA
BBBAABABABBBBBABAABA
AABAAAAAAAAABAAABBBA
BAAAABABBBABAAAABABA
BAAAAABBBA...

output:

148743

result:

ok 1 number(s): "148743"

Test #19:

score: 0
Accepted
time: 44ms
memory: 11200kb

input:

5000 20 12302677
BBAABBBAAAAABAAAAAAB
AABBBAAAAABAAABBAAAB
AABABAABBBAAAABAAABB
BBBBBABAABAAAAAABBBA
AABBAAAAABBAABABABBB
BBAABAAABABBBBBAABAB
BBAAABAAABBBBBAABBBA
BBABBAABAABBABBABBAA
ABABBABABBBAAABBBBBB
BAABBAABBBAABBBAAABB
ABBBBAABBABBBAAABBBA
AAABABAAAAAAABBBAABB
AAAABBBBAABBBBABBBAA
AAABBBAAAA...

output:

993237

result:

ok 1 number(s): "993237"

Test #20:

score: 0
Accepted
time: 14ms
memory: 3464kb

input:

200000 1 9999998911
A
B
B
A
B
B
A
A
A
B
B
B
B
B
A
B
B
A
B
B
A
A
A
A
B
B
A
A
A
B
A
B
B
A
A
B
B
B
A
A
A
B
A
A
A
B
A
A
B
A
B
B
B
A
A
B
B
B
A
B
B
A
A
B
B
A
B
B
B
A
A
B
B
A
B
A
A
B
A
A
A
B
A
B
B
B
A
B
A
B
B
B
B
A
A
B
A
B
B
B
A
B
A
A
B
B
B
B
B
A
A
B
B
A
A
B
A
B
A
B
A
B
B
A
B
B
A
A
B
B
B
A
B
A
A
B
B
B
B
B
...

output:

1

result:

ok 1 number(s): "1"

Test #21:

score: 0
Accepted
time: 17ms
memory: 3392kb

input:

200000 2 1
BB
BA
BB
AB
BB
BB
BA
BA
AB
BA
AB
BA
AB
AB
AA
BA
BB
AA
BA
BB
AB
AB
AB
AB
BA
BB
BA
AA
AA
AB
BB
AA
AA
BB
BB
BA
AB
AA
AB
AB
AA
AB
BA
AA
BA
AA
AB
BB
AA
BB
BB
BA
BA
BA
AB
AB
AA
BA
BB
AB
AA
BA
BA
AB
BA
BA
BA
BB
BB
BA
BA
BA
AA
AB
AB
AB
AB
BA
AB
BA
BB
AB
BB
BB
AB
BB
BB
BA
BA
BB
AB
AA
AB
AA
BB
BB
A...

output:

3

result:

ok 1 number(s): "3"

Test #22:

score: 0
Accepted
time: 16ms
memory: 3388kb

input:

200000 3 14999990279
ABB
BBA
BAA
BBA
AAA
AAB
BBA
BAA
BBB
BBB
BAB
ABB
BAA
BBB
BAB
BBB
BBB
BBA
ABA
BAB
BAA
BBB
ABA
BAB
AAA
BAA
BAA
BAA
BBA
AAB
BAA
ABB
BBA
AAA
BAB
AAB
ABB
AAA
AAB
BAA
BBB
ABA
BAB
ABB
AAB
BBA
BAB
AAA
BBB
BAA
ABA
AAA
ABB
BBB
AAB
AAB
AAB
AAB
ABB
AAB
BAB
AAB
ABA
BAB
ABB
BAB
ABA
ABA
ABA
AAB...

output:

2

result:

ok 1 number(s): "2"

Test #23:

score: 0
Accepted
time: 21ms
memory: 3364kb

input:

200000 4 14999997039
BAAB
BABA
AABA
BBAA
BAAA
BABB
ABBB
AAAB
AAAA
BABA
AAAB
ABAA
AABA
AABB
BBBA
AAAB
AABB
BBAA
BBBA
BBBA
BABB
BBBB
ABBA
BABB
AAAA
ABAB
ABBA
BBBB
BAAA
ABAA
ABBB
BBAA
ABAA
BAAB
ABAB
BBBA
ABBA
BBAA
BBBA
AAAB
ABBA
BBAB
AAAB
AABB
BBBB
ABBB
AABA
BAAB
ABAA
ABBB
BABA
BBAB
BBAA
AAAA
ABAB
ABAA...

output:

7

result:

ok 1 number(s): "7"

Test #24:

score: 0
Accepted
time: 20ms
memory: 3416kb

input:

200000 5 17499883577
BBAAA
ABBBB
ABBAB
AABBA
ABABA
BABAB
BAABA
BBBBB
ABABB
AABAA
BBAAA
ABBAB
BBBBA
BAABA
BAAAB
ABAAB
AAABA
BBABA
AABAA
BAABB
AAABA
AAAAB
ABAAB
BABAB
BBBAB
AABAA
ABAAB
AABAB
AAAAA
BAABB
AABAA
BAABA
BAAAB
ABAAA
BBBAA
BAABA
BABBB
ABBAB
BAAAA
AAAAB
BABBB
BBAAB
BBABB
ABABB
BBABA
BAABB
ABA...

output:

12

result:

ok 1 number(s): "12"

Test #25:

score: 0
Accepted
time: 22ms
memory: 3368kb

input:

200000 6 19687442613
ABBBAB
AAABBB
AAABAA
AABABB
ABAAAB
ABBBBA
AABAAA
BBBABA
BBAAAA
ABAABA
ABBBBA
ABABAA
ABABAA
ABBABB
ABABAA
AABBBB
AABAAA
ABAAAB
BAAABA
BBABAA
AABABA
AAAAAB
BABBAA
AABBAA
BBBBAB
ABBBAB
BBBBAB
ABABAA
ABBBBA
BBBBBB
BAABBB
BBBBBB
AAAAAA
ABABBB
AABAAA
AABBBA
BABAAA
ABABBB
AABBBB
BBBAAA...

output:

1

result:

ok 1 number(s): "1"

Test #26:

score: 0
Accepted
time: 30ms
memory: 3396kb

input:

200000 7 14999854317
BAABBBA
ABAABBA
ABABBAA
AABBBAB
BBABBAA
BBBAAAA
ABBBBBB
ABBBABB
AABBAAA
AAAAABB
BAABBBA
BBBBBBB
BABAAAA
AABAAAB
AABAABA
BABAAAB
BAAAABB
ABABBBA
ABBBBBA
BABBBBA
AAAAABB
AAAABAB
BAABABA
AABAABA
ABBAABA
AAABBAA
AABBABA
BBBBBBB
BABBBBA
ABBAABA
BBBBABA
AABABAA
BBBBAAA
BBAABAA
ABAAAAB...

output:

118

result:

ok 1 number(s): "118"

Test #27:

score: 0
Accepted
time: 31ms
memory: 3412kb

input:

200000 8 17499967620
AABAAABA
AABBABAB
BABBABBB
BABAAABA
AABABABB
BBBBABBB
BAABBBBA
ABBAAABA
ABBABABB
BBBBABBB
AABABABB
BBAABBAA
AAAAAAAA
BAAABABB
ABBBBBBA
BBBBAAAA
BABBBBAA
ABAABAAA
BBABABBA
BBBBABBA
BBABABAA
BAAAAAAA
BABAAAAB
AABBBBBB
ABBBBAAB
ABAAAABA
AAABABAA
AABABBBB
BBABBAAA
AABBAABA
AABAABAB
...

output:

171

result:

ok 1 number(s): "171"

Test #28:

score: 0
Accepted
time: 35ms
memory: 3392kb

input:

200000 9 19687407472
BBBBAABAB
BABAABABA
BBBBBBABA
BABBABABB
BABBAAABA
AAABBABAA
AABABBBBA
BABBBAABB
BBBBBAAAA
BABBBBBAA
BBBBABBBA
BBBAABBAA
BBABBBBBB
ABBBBABBB
BBBABABBA
AAABBABAB
BAABBAABB
BAABABBAA
BAABBAABA
BAAAABAAB
BBBABBBAA
BAAABBABB
BAAAABBAA
AABABABAA
BABABAABA
BBABABBAB
BABAABAAB
ABABABBBB...

output:

96

result:

ok 1 number(s): "96"

Test #29:

score: 0
Accepted
time: 38ms
memory: 3364kb

input:

200000 10 17499854307
ABAABBBAAA
AAAAAABAAB
BAAAABBABB
ABAAAABAAB
BBAABABBAB
BBABAABABB
BAABAABBBA
ABBAABBBBA
ABABBBBAAA
BAAAABAABA
BBAAAABAAA
BABAABABBA
BBABBABBAB
BBBAAAAAAB
ABABAABBAA
AABBBABAAA
BBABBAAABB
ABAABAAABA
AAAABABAAA
BABBBBBBAB
BABABAABAA
AAAABBABAA
BAABBBAABA
ABBBAAAABB
BAABBABABB
AAA...

output:

965

result:

ok 1 number(s): "965"

Test #30:

score: 0
Accepted
time: 39ms
memory: 3380kb

input:

200000 10 1
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BBABBABABB
BB...

output:

0

result:

ok 1 number(s): "0"

Test #31:

score: 0
Accepted
time: 39ms
memory: 3444kb

input:

200000 10 15999912512
BABBAAABAA
BAAAAAAABB
BAABBBBABB
BAABBBBABB
BAABBBBABB
AAABAABBBB
BABBAAABAA
BABBAAABAA
BAAAAAAABB
BABBABBAAA
BABBAAABAA
BABBAAABAA
AAABAABBBB
BABBABBAAA
AAABAABBBB
AAABAABBBB
AAABAABBBB
BABBAAABAA
BABBAAABAA
BABBABBAAA
BABBABBAAA
BABBAAABAA
BAAAAAAABB
AAABAABBBB
BABBABBAAA
BAB...

output:

730

result:

ok 1 number(s): "730"

Test #32:

score: 0
Accepted
time: 38ms
memory: 3444kb

input:

200000 10 17197467436
AABABAAABA
BAABAAABBA
ABAAABABAB
BAABABAAAA
AABABABAAB
ABAAABABAB
BAABAAABBA
ABBAABBABA
ABAAABABAB
ABBAABBABA
BAABAAABBA
ABBABABBBB
BAABAAABBA
AABABAAABA
AABABABAAB
BAABAAABBA
AABBABBABA
AABABABAAB
ABABABBBAB
AABABAAABA
BABBBBABAB
BABBBBABAB
AABABABAAB
ABAAABABAB
ABABABBBAB
BAB...

output:

768

result:

ok 1 number(s): "768"

Test #33:

score: 0
Accepted
time: 38ms
memory: 3416kb

input:

200000 10 19376668500
ABBBABBBBA
BAAAABABBB
BBAABBABBA
BBABAABBBB
ABBBABBAAA
ABBBABBBBA
BBBBAABBAA
BABBBAABBB
ABBBABBBBB
ABBBABBAAA
ABBAABABAA
AAAABAABBB
ABAAABAAAA
BBABAAABBB
ABBABBABBB
BBBBBBABAB
AAAAAABAAA
AABBABBAAA
ABABABBABB
ABBBABBBBB
ABBBABBBBA
AAAABAAAAA
ABBABABAAA
ABABABBABB
BAAAABABBB
BAA...

output:

201

result:

ok 1 number(s): "201"

Test #34:

score: 0
Accepted
time: 38ms
memory: 3436kb

input:

200000 10 18587084437
BBABBABABA
AABBABABAB
BBAABBABBB
ABAABBABAA
BBBBBBAABA
AABBAAABAA
BABBAABABB
BABBABAABA
BABBBABAAB
BAAABBAAAA
ABABAABABB
BBBAABBABA
BAABABABBA
ABBBAABABA
BBABAAABBA
BAABABABBA
ABABBAAAAB
BAAABBAAAA
BAABBAAABB
BAABABBAAA
BBAAABAABA
BBBBAABBBB
BBABBABABA
BABAAABAAB
BAAAABABAB
BBA...

output:

697

result:

ok 1 number(s): "697"

Test #35:

score: 0
Accepted
time: 39ms
memory: 3368kb

input:

200000 10 19669942496
ABAABBBBBB
AABBBBABAA
ABAABBABAB
ABBAAABBBB
BAAABAABBA
AABAAAABAB
BBAABBABAA
BAABBBBABB
BABAAABABA
ABAAAAABBA
ABAABBABBA
BABABBBAAA
BBBAAAAAAA
BBBBBBBABA
BABBABBBAA
AABABBBABB
BBAAAAAABA
AAABAAAAAA
BAABBABAAA
BAAAABABBA
AAABBABAAA
AAABBBBAAA
ABAABABBAB
ABBBAABBAB
AABAAABBAB
BBB...

output:

198

result:

ok 1 number(s): "198"

Test #36:

score: 0
Accepted
time: 41ms
memory: 3448kb

input:

200000 10 18749762838
AABBABABBA
AABABABABB
BBABBBBBBA
AABBABBBBB
BBAABAAABB
BAAAAAABAB
ABABABBBAA
ABBBAAABBA
ABBBAAABBB
AAAABABAAA
AAABBBAAAA
AABBAAABBA
AAAABBABAA
BBABBABABA
AABBBBAAAA
AAAABAABAB
BBBAAAAABA
BBBBBABABA
AABABBAAAA
AABABAAAAA
AAAAABBBBA
AABAABABAA
BABBAABBBA
AAAAAAABBB
AABBABAABA
BBA...

output:

641

result:

ok 1 number(s): "641"

Test #37:

score: 0
Accepted
time: 40ms
memory: 3416kb

input:

200000 11 19374883366
BABBBBBABAA
ABABBBAABBA
AABABBAAABB
ABABABABABB
AABBAAABABB
AABABBABBAB
AABAAABAAAA
BABBBBAABBB
AABAAABBBBB
AAAABBABBBB
ABBBBABAABA
BAABBABBABB
ABBABABBAAA
AABABAAAAAA
BBAAABAAABB
ABBAABABAAA
BBBABBBAABB
ABABABBAAAA
BABBBBBAABA
BBBBABABAAA
BAAAABBBABA
AAAAABBABAB
AABABAAAAAA
AB...

output:

1402

result:

ok 1 number(s): "1402"

Test #38:

score: 0
Accepted
time: 43ms
memory: 3436kb

input:

200000 12 17499945718
AAABAAABABBB
AABABBAAAAAA
ABBAAAAABABA
ABAABAAABBBB
AABAAABAABBA
AABBBAAAAABA
BBBBBBABABBA
BABABAABAABA
BABBAAAABBBB
ABBBBBAAABAB
BAABBBBAAAAB
ABBBAAAAAABA
BAAABABBABBB
BAAAABAAABBB
BABBBBBABBAB
AAAABBBBAABA
BBAABABBBABB
BAAAAABBBBBA
ABABABABAABA
BAAAABBAABBB
BABBABAABABB
BAAAB...

output:

3887

result:

ok 1 number(s): "3887"

Test #39:

score: 0
Accepted
time: 41ms
memory: 3416kb

input:

200000 13 19374912951
ABAABAABBBABA
BABBABAABABBA
AAABBABBBBAAB
BBABBBBABBBBA
BABBBBBBBABBA
BABAAAABABABB
BAABBBAABABAB
AABBABBBBAAAA
ABBABABAABBAB
AABBAABBAABAA
AABABAABABBBA
ABAAAABABAAAA
AABBAABBAABAB
ABBBABAAAABBB
BBBABABBAAAAB
BAABBBAABAAAA
AAAABBAABABAA
BAABBAAABBBBB
BBBABABBABBBA
BBAABAAAAABA...

output:

6372

result:

ok 1 number(s): "6372"

Test #40:

score: 0
Accepted
time: 47ms
memory: 3348kb

input:

200000 14 19980372123
BABBBAABAAABAA
BBBAABAAABABAB
ABABABABABAABB
BBAAABBBBBBBAA
ABBABBABBABABA
ABBBABBBAAAAAA
AABABBABBBAAAB
AABAAABABBBBBB
AAAAABABBABBAA
BBABBABABBBBAB
BBBBABABAABAAB
ABBABBBAABBBBB
BBBAAABBABABBA
BBABBBAAABABBA
AAAABBAAABBABA
BBAAAAABBABBAA
AABBAAABAABBAA
BAAABBBAABBABA
AABAAAAA...

output:

665

result:

ok 1 number(s): "665"

Test #41:

score: 0
Accepted
time: 52ms
memory: 3348kb

input:

200000 15 19980372402
AAABABABBABAAAA
BAAAABAABBBAABA
AABBBBBABAAABBA
AABBAABAAAAABBB
BBBBABBABABBBBB
ABBABABABBBAABA
BBBBABAAABAABBB
BBABBAABAABBBBA
BAABABBBAABAABA
BAABABBBBAABBAA
ABABAABBABABBAA
ABABABABBBABBAA
ABAAAABBAAAAABB
AAABAABAAAABBBB
ABABAAABBBABBAB
AABBAABBBAABBBA
AAABABBBBBAABAA
AAABAA...

output:

3150

result:

ok 1 number(s): "3150"

Test #42:

score: 0
Accepted
time: 55ms
memory: 3488kb

input:

200000 16 19921763623
BBAABBABABAAAABB
BBABBAAAAABAABAA
BBBBAABAAAAABBAB
AABABBABAAAABABB
AAABABAABABAABBA
BBBBBBABBABBAAAA
ABABABABAAAAAAAA
ABAABBBBBAABBBBA
ABAABBAAAABBBBAA
BBBABBBAAABAAABA
BABAABBBAAAABAAB
BBBBBABBAAABBBBB
BABBBBABABBAABBA
BABABABAABBABAAB
AABAABBBAAAAABAB
ABBABAAAABBAABBA
AABAAA...

output:

38403

result:

ok 1 number(s): "38403"

Test #43:

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

input:

200000 17 19921783725
BABBBBABBBBBBBBAB
AABABAAABAAAABAAB
BAAAABAABBBBABAAB
AABBBAAABAAABBABA
AAAAABBBAABBAABAA
AAABABAAAABABBBAA
AABAABAABBBBAAABA
ABABAABABBBABBAAB
AABBBBBABBAABABAA
BABAAAAABBBBABBAA
AAAAAAAABBBAAAAAB
BBAABAAAABBABABAA
AAABBBABAABBABBAB
ABAAABBAAABABBABA
BABBBBAAABBAABBAB
AAAAABBA...

output:

73656

result:

ok 1 number(s): "73656"

Test #44:

score: 0
Accepted
time: 74ms
memory: 5068kb

input:

200000 18 19921779649
AAABAABBAABBBBAAAB
ABBBAAAAABBBBAAAAA
BBAABBBBBABBABABBA
BABAAAABBAAABAABAA
BAABBAABAABABBAABB
AAAABAABABABBABBAA
BBBBBAABBABBBAAAAA
BAAAABABAABABBBBBA
BABAAABBABABABBABA
AABABAABBAABBAABAB
BBABBAAABABBBBBABB
BBBAAABABBAABBABAA
BBAABBABABAABBBABA
BBBBABBAABAABABBBB
BBBABAABBBAB...

output:

174446

result:

ok 1 number(s): "174446"

Test #45:

score: 0
Accepted
time: 88ms
memory: 7132kb

input:

200000 19 19998678767
BBAABABBBAABBBBBABA
AAABAAAABBABBAAABAB
BABAAABBAABBABAAABA
BABBABBBBAAABBBAABA
ABAABABAAABBBAAAAAA
BAABBBBBAAAAAABABBB
ABABBAAAAABBABABBBB
AAABBBBBBAAABBABAAA
ABBBAAAAABAAAAABABB
ABAAABAAAABAAABBAAB
ABBABBAABBAABBBBBBB
BBABBBBAAAAABAAABAB
ABBBABABAAABBBBABBA
BABBBBBAAAAABBBBAB...

output:

13094

result:

ok 1 number(s): "13094"

Test #46:

score: 0
Accepted
time: 80ms
memory: 7132kb

input:

200000 19 1
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABABABBBAABAAB
AAABBABA...

output:

0

result:

ok 1 number(s): "0"

Test #47:

score: 0
Accepted
time: 84ms
memory: 7192kb

input:

200000 19 15999918345
AAABBBBBBBAAABAABBB
BBABBBABBBAAAAAAAAA
BBABBBABBBAAAAAAAAA
AAABBBBBBBAAABAABBB
AAABBBBBBBAAABAABBB
BBABBBABBBAAAAAAAAA
BBABABBABBAAABBABAA
BAAABAABBBBABBBAAAB
BBABBBABBBAAAAAAAAA
BBABABBABBAAABBABAA
BBABABBABBAAABBABAA
BBAAAABBBAABBBBAAAA
BBABBBABBBAAAAAAAAA
BBABBBABBBAAAAAAAA...

output:

498656

result:

ok 1 number(s): "498656"

Test #48:

score: 0
Accepted
time: 81ms
memory: 7116kb

input:

200000 19 17999910984
BBBABABBBBAABAAABBB
ABBBBAABAAAAAAABABA
ABBBABBBBBBBABBABAB
ABBBBAABAAAAAAABABA
ABBBABBBBBBBABBABAB
ABABAABBABBAABABAAA
BBBABABBBBAABAAABBB
BBBAABBBAAAAAAABBBA
ABBBABBBBBBBABBABAB
BBBAABBBAAAAAAABBBA
BBAABBBABBBBABABBAA
BBBABABBBBAABAAABBB
ABBBBAABAAAAAAABABA
BBBABABBBBAABAAABB...

output:

437471

result:

ok 1 number(s): "437471"

Test #49:

score: 0
Accepted
time: 81ms
memory: 7128kb

input:

200000 19 19599890919
AABAAABAABAABBBBABB
BAAABBBABBAAABBABAA
ABBBBBBBABABAAAABAA
ABBBABAAAABBBBBBBAA
AAAABAAAABBBBBAABAA
AABBABBAAAAABBBBBAA
AAAAABBAABABBAAAAAB
ABBBABAAAABBBBBBBAA
BAAABBBABBAAABBABAA
ABBAABBBBBBABBAABAB
AAAAABBBAABBABAAAAA
ABBBAABABBABABBAABB
BABAAAAABABABAAAABB
BBABBAAABAABBAABAA...

output:

130053

result:

ok 1 number(s): "130053"

Test #50:

score: 0
Accepted
time: 87ms
memory: 7192kb

input:

200000 19 19719579316
BBAAAABBABAABBAABAA
ABAABBAABABBAABAAAB
ABBABABBBBBBAABABBB
BABBAAABBBBABAAAAAB
ABBBBBBBBBAAAABBBBB
BAAAABBBBBBBBBABABA
ABAAABBBAABBAAAABAA
BABBABAAAAAABABABBB
ABABBABAABBBBBBABBB
BBBAABABBBBAABAABAA
ABABABBBABBAABABAAB
AABABAAAABBBBBBABBA
BABAABABBABBAAAAABA
BABABBAABBBBAAABBA...

output:

397548

result:

ok 1 number(s): "397548"

Test #51:

score: 0
Accepted
time: 85ms
memory: 7192kb

input:

200000 19 18719925174
AABBABABBABBBABABAB
ABAAABABABBBAAAAAAB
AABAAABBABBBABABBAB
BABABBAABAAAABBBBBB
AAABBABBAABABAABBAB
BBBAABBBABABABABBAB
ABBAABAABABBBBAABAB
BBABBABABBABBABBBAB
BAABAABBAABABABAAAA
ABAAAABABBBBBAABABA
ABAAAABABAAAAABBBBB
ABBBABBABAAABBBBABA
BBBABABAAAAABAAAAAA
AAABAAABAAABAAABAA...

output:

520845

result:

ok 1 number(s): "520845"

Test #52:

score: 0
Accepted
time: 81ms
memory: 7120kb

input:

200000 19 19959307756
BBAAABABBABABAABAAB
BABBBABABBBBABABBBB
BABBBBAAAABBAAABBBB
BBBBAABAAAABAAABBBA
BAABBBBABBABAAAABBB
BBAAAABABABBBBAABBA
ABABABAAABBBBABAAAB
BABBAABABBBAAAABABB
BBABBBBAABAABABBBAB
BAAAABBABAAABABABAA
BBAABBBAABBABBABBBB
BAAAAABAABBABABABAB
BBBABBBABAABBBBBABA
BAAAAAABAAAABAAAAB...

output:

247886

result:

ok 1 number(s): "247886"

Test #53:

score: 0
Accepted
time: 82ms
memory: 7080kb

input:

200000 19 19991028941
ABAAAABBBABABBABAAB
BBBBBBAAABABABABAAA
BBABBBAABBABABABBAB
AAAABBABBBBABABABBA
BBBBBAAAABBAAABBBAB
BAAABABAABABAAABABB
AABAABABABAABBBABBA
ABAABBBBABAABABBABB
AABABBABABABBBAABAB
BAABABAAAABABBABBAB
ABBABABBABABBABABAB
AABBAABBAABAAABBAAB
AAAABBBAABABBABAABA
BABAABAABBBBABAAAB...

output:

78389

result:

ok 1 number(s): "78389"

Test #54:

score: 0
Accepted
time: 77ms
memory: 7184kb

input:

200000 19 19958795374
BBBABABBBBBBBABBAAA
ABBBABBBBBABBABAAAB
AAAAABABBABABBAABBA
AABAAABAABAAABABABB
ABBABBAABABBABBAABA
ABBBABBBBABBBAABABA
AAABAAAABAAAABBBBAB
BAABAAAABAABBBBBBAA
ABAABBBBBBBABAABBAB
BAAABABABABBBBABAAA
ABAABBBBABBBBBBBABA
BBAAABABAABBBABBABA
BBAAAAAABBBBBAABABA
AAABAAAABAAAABBBBA...

output:

334238

result:

ok 1 number(s): "334238"

Test #55:

score: 0
Accepted
time: 82ms
memory: 7116kb

input:

200000 19 19960448555
BBAAABBAABBBBBBBBBB
BBBBAABAAABAABAABBB
ABABBBBABABAABABABA
BAABBBBAAABBBBBABAA
BBAABAAABABBAAAAABA
BBBBBABABABBABBBBAB
BBAAAABBAAAABBBBBBB
BBBABAABAAABABBBBAA
AAABBABAAABABAABABA
BABBBABAAABBBABBBAB
AABBBABABABBAAAAAAB
ABAABAAABBABABBAAAA
ABBBABBBBBABAAAABBA
BBBBBABBBBBBBABAAA...

output:

349440

result:

ok 1 number(s): "349440"

Test #56:

score: 0
Accepted
time: 81ms
memory: 7116kb

input:

200000 19 19980263140
ABAAAAABBBBAAABABAB
BAAAABABAABABABBABA
AABABBBABBBABBAABBA
BABBABABABBBABABBAA
BAABBABBBBBBBBAAAAB
ABABAAAABAABABBABBB
BAAAAAAAAABBAAABBAB
BABBBBABBBAAAABBAAB
BABAAABABABBBABABBA
ABBAAABABBBAABABBBB
AAAABABBBAABAABAABA
AABBBABBAAABBABBABA
BAABBAABABABABBBBBA
ABAABABAAABABBBBBB...

output:

206671

result:

ok 1 number(s): "206671"

Test #57:

score: 0
Accepted
time: 82ms
memory: 7180kb

input:

200000 19 19687449585
ABABAABBAAAAAAABBBA
AAABBABBBABBBBABBAB
BBAABABABABBAABABAB
ABABBAABABBABBABBBA
BBBBAAABBBBBBABAABA
BABBABABBAAAABBBAAA
AAAABAAABAABBBABABA
AABAABBBAAABAABABBB
ABBBABBAAAAAABBAAAA
BABBABABBABBBBABBAB
BAABAAAAABBBAABBAAA
BABABABBAAAAAAAABBB
BBABAAABBBBABAAABBA
BAAABABBAABBAABABB...

output:

485423

result:

ok 1 number(s): "485423"

Test #58:

score: 0
Accepted
time: 117ms
memory: 11212kb

input:

200000 20 19980375286
ABBBBAABBBABAABBBBBA
ABABAAABBABBABBABBAB
BBBAAAABABBABABAABAB
BBBAAABABABBABAABAAB
AABBAAAABBBBABAAAAAA
ABABBAAABABABBBABBAA
BABBBBAAABABAAAAABAB
ABAABBBBBABBABABAAAB
AAAABBAABBBBBBABBBBA
BAABBBBBABBBBABAAAAB
ABAAAAAABBABBBBBAABA
BBBBBBAABBABABAABAAA
AABBBAAABAAABBABABBB
ABABB...

output:

444096

result:

ok 1 number(s): "444096"

Test #59:

score: 0
Accepted
time: 109ms
memory: 11288kb

input:

200000 20 1
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABABBBAAB
BABBAABBAABABAB...

output:

0

result:

ok 1 number(s): "0"

Test #60:

score: 0
Accepted
time: 106ms
memory: 11268kb

input:

200000 20 15999914477
BAABBBAABAABAAABBBAB
ABBAAABBBBBABBAAAABB
ABBAAABBBBBABBAAAABB
BABBBBBBBBABAABABBAA
ABABBBBABBABAABAABAB
BAAABABBAAABBBBBAABA
ABABBBBABBABAABAABAB
BABBBBBBBBABAABABBAA
BAABBBAABAABAAABBBAB
BABBBBBBBBABAABABBAA
ABABBBBABBABAABAABAB
BABBBBBBBBABAABABBAA
BAABBBAABAABAAABBBAB
BABBB...

output:

1016656

result:

ok 1 number(s): "1016656"

Test #61:

score: 0
Accepted
time: 102ms
memory: 11200kb

input:

200000 20 17999925959
AABBBAABABAAABBAAABB
BBAAAAABBBABBBBAABBB
BABABBBBAAAABAABBBBB
AABBABAABABAABBAABBA
BABABBBBAAAABAABBBBB
AAAAAAABBBAAAABAABBB
AABBBAABABAAABBAAABB
BBAAAAABBBABBBBAABBB
BABABBBBAAAABAABBBBB
AABBBAABABAAABBAAABB
BBAAAAABBBABBBBAABBB
AABBBAAAAAAABBBBAABB
BABABBBBAAAABAABBBBB
AABBB...

output:

848192

result:

ok 1 number(s): "848192"

Test #62:

score: 0
Accepted
time: 110ms
memory: 11224kb

input:

200000 20 19599929715
AAAABBBBAABABAAAABAA
BAAAAAAABBABABAAABAB
BBBABBAABAABBBBABABA
BAAAAABABAAAAABBBABB
BBAAAABAABBAABAABABB
BBBABABAABAABAABBAAB
BBBBBABBABBBAABBABAA
AAAABBBBAABABAAAABAA
AAAAABABABAAABAABABB
AABBBABABAABBABBBAAA
BAABAABABBBAABAABBBB
BBAABABBAAABAAAAAABA
BBAAAAAABBBAABABABBB
BBBAB...

output:

419266

result:

ok 1 number(s): "419266"

Test #63:

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

input:

200000 20 19780102477
AAAABBABABAAAABBABBA
AABBABABAAABBBABABAA
ABBBABAABAABBBBBBBBB
BAABAABBBBBBAAABABBB
ABABABBAAAAABAABBABA
ABBABBBABBBBBABABBAB
BABBABAABBBAAABBAAAB
AAABBAABBBABAABAABAA
ABBBBAABBAABAABBABBA
BBBABBAABBABAAABAABA
BAAABBBBBBAAABABBBAB
ABBBABAABAABBBBBBBBB
BBAAAABABABBAAABAABB
ABBBA...

output:

544749

result:

ok 1 number(s): "544749"

Test #64:

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

input:

200000 20 19885391989
BABABABAAABAAAAABAAB
AABBBBBABAAABBABBAAA
BBABAABBBBBBBBBABBAB
AAABAABBAAABAAABABAA
AABBABABBBABAABAAAAB
AAABBBBABBAABBAAAABB
BAABBBAAAABABABABBBB
BBBBAABABABBAAAAABBB
AAAAABABBBAAABAAAAAB
AAABABAAAAABBAAABBAB
BAAAAAABBAAAABABBABA
BBBBBBABBABBBBAAABBA
BABABBAABABBBBBAABAB
AABAA...

output:

801683

result:

ok 1 number(s): "801683"

Test #65:

score: 0
Accepted
time: 113ms
memory: 11176kb

input:

200000 20 19941817038
ABABABBBAAAABBBBABAA
BABBBBAABBBBAAAAAABB
ABABABBAABBABBBBABAA
AAAABABABBAABBBBAABA
BABABBAABBBBBBABBBAB
BBBBBABAABBBABABAABA
BBBBBBABAABABBBBABBA
AAABABABAABAABABBBBA
BBBBBAAAAABBBAABBBAB
ABBABABBBBAABABBBBBB
BAAABBAAABAABBAAABAB
BAAABBAAABAABBAAABAB
AAAAABBBABBBABBBBABB
BABAB...

output:

653509

result:

ok 1 number(s): "653509"

Test #66:

score: 0
Accepted
time: 104ms
memory: 11196kb

input:

200000 20 19976506600
BBBAABAAAAABBABBBBBB
AABBBBBBABBBBBBAAABB
BAAAAAAABBBBBAAAABBB
BBAAABBBBABBBABBBBBB
BBABBABBBBABBABAABBB
AABBABAAABAAABABABBA
BBBBAABBBAABABBABBAB
AAABBBBBABAABBBBBBBB
ABBBAAAAABBBAAAABBBB
AABBBABAAAABABBBABAB
AABABBBABABAABABBBAA
ABBBABABAABBAAAAABBA
BBABBBBABBBABABAAABB
ABBBB...

output:

481280

result:

ok 1 number(s): "481280"

Test #67:

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

input:

200000 20 19992983839
AAABABBAABAAAAABBBAA
ABABBBBAABABAABBBBBA
ABAAAABAAAAABAABBABB
AAABBBABBAAABAABBABA
AABBABBABABBABAABABB
BAABAABAABBBBAAAABBB
ABAAABBBAAABABBBAABB
ABABABBBBBAAABBBAABA
AABBBBABAABAAABBAAAA
BBBABAABABAABBBABBAB
AABBABAAABABABAAAAAA
BBABAAABABBBBAAAAABB
AABBABBAABAAABBABBBA
AABBB...

output:

242175

result:

ok 1 number(s): "242175"

Test #68:

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

input:

200000 20 19989794025
BBABBBBABAABBBBBBAAA
AABABBABBABBABBBABAB
ABAABABAAAABABBBABAB
BBBBBBBAABAABBBAABAA
ABBAAABABBABBAABBABA
AAAABABAAABAAABBABAB
AABBAABABBBBABAABBBA
AAABBBABAAABAAABBBBB
ABBABBAABBBBBBBABBAB
BAABBABAAAAAAAAABABA
BABBBBBBBAABBABBBBBB
BBBBBABABABABBAABBBB
BABAABBBABABAAABBAAB
BAAAA...

output:

282959

result:

ok 1 number(s): "282959"

Test #69:

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

input:

200000 20 19994890116
AABBABBBAABABBABAABB
BAABBBBBBAABABBBBBBB
BBAABAABAABABABBBAAA
AABABBBBBBAABABBBAAB
BABAAAABAAAABBBBAAAA
BBAAAAABAAAABABABBAB
ABAAAAABABABBBBBAAAA
ABABABBBBAAABBAABAAA
ABABABBBBBBBBBBBBAAA
ABBABBBBABBAAABAABBB
BBBBBBBBBBBBAAAAAAAB
ABABABBABBBBABAAAAAB
BABBBAABBAABABAABBBA
ABAAA...

output:

169460

result:

ok 1 number(s): "169460"

Test #70:

score: 0
Accepted
time: 124ms
memory: 11276kb

input:

200000 20 19960849809
AABAABABBAAABBABABBB
BAAABBAABBBAABBABBAA
BAAABBBABBAABABBABAA
BBBAABABBABBBABABBBA
ABAABBABABBAAABBABAA
BBBBBBBBABAABBBAABAA
ABBBBBABBBBBBAAABAAA
AABBBAABABABBABBBBBA
BABABBABBABBAABBAABB
BBBBABBBAABAABAAAAAB
BAAABABBBBBABBAABBBB
ABBABAAAABBABAAABABA
AAABBABBBBABBBBAABAA
ABABA...

output:

772436

result:

ok 1 number(s): "772436"