QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235885#6611. United in Stormwindwhsyhyyh#AC ✓53ms17612kbC++141.4kb2023-11-03 12:00:092023-11-03 12:00:10

Judging History

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

  • [2023-11-03 12:00:10]
  • 评测
  • 测评结果:AC
  • 用时:53ms
  • 内存:17612kb
  • [2023-11-03 12:00:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long  
const int N = 2e6+9;

void FWT(ll *f,int n,int flag){
    for(int p=2;p<=n;p<<=1){
        int len=p>>1;
        for(int l=0;l<n;l+=p){
            for(int k=l;k<l+len;k++){
                ll tt=f[k+len];
                f[k+len]=f[k]-tt;
                f[k]=f[k]+tt;
            }
        }
    }
    if(!flag){
        for(int i=0;i<n;i++) f[i]/=n;
    }
    return ;
}


int n,m,k,a[N];
char s[N];
ll f[N];

signed main(){
    scanf("%lld%lld%lld",&n,&m,&k);
    for(int i=1;i<=n;i++){
        scanf("%s",s);
        for(int j=1;j<=m;j++)
            if(s[j-1]=='B') a[i]=(a[i]<<1)|1;
            else a[i]=(a[i]<<1);
    }
    for(int i=1;i<=n;i++) f[a[i]]++;
    int len=(1<<m);
    FWT(f,len,1);
    for(int i=0;i<len;i++) f[i]*=f[i];
    FWT(f,len,0);
    // for(int i=0;i<len;i++) printf("%lld %lld\n",i,f[i]);
    for(int i=1;i<len;i++) f[i]/=2;
    // for(int i=len-1;i>=0;i--){
    //     for(int j=len-1-i;j;j=(j-1)&(len-1-i)){
    //         int x=j+i;
    //         f[x]+=f[i];
    //     }
    // }
    for(int i=0;i<m;i++)
        for(int j=0;j<len;j++){
            if((j>>i)&1){
                f[j]+=f[j-(1<<i)];
            }
        }
    // for(int i=1;i<len;i++) printf("%lld\n",f[i]);
    ll ans=0;
    for(int i=1;i<len;i++) if(f[len-1]-f[len-1-i]>=k) ans++;
    printf("%lld\n",ans);
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2 1
AA
BB

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

2 2 1
AA
AB

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

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: 1ms
memory: 5900kb

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

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

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

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: 1ms
memory: 5976kb

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

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

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: 33ms
memory: 15628kb

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: 26ms
memory: 14096kb

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: 33ms
memory: 15592kb

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: 33ms
memory: 15732kb

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: 35ms
memory: 14232kb

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: 33ms
memory: 14732kb

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: 36ms
memory: 15760kb

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: 34ms
memory: 14480kb

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: 36ms
memory: 15328kb

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

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: 8ms
memory: 7376kb

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: 8ms
memory: 7568kb

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: 8ms
memory: 7416kb

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

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

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

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

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: 10ms
memory: 7384kb

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: 12ms
memory: 7520kb

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

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: 11ms
memory: 7420kb

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: 8ms
memory: 7500kb

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: 12ms
memory: 7496kb

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: 11ms
memory: 7552kb

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: 11ms
memory: 7576kb

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

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

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: 12ms
memory: 7528kb

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: 13ms
memory: 7480kb

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: 13ms
memory: 7636kb

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: 14ms
memory: 7736kb

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: 15ms
memory: 10004kb

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: 17ms
memory: 8396kb

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: 22ms
memory: 10040kb

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: 28ms
memory: 12504kb

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: 28ms
memory: 11476kb

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: 31ms
memory: 12488kb

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: 31ms
memory: 12708kb

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: 29ms
memory: 11600kb

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: 31ms
memory: 12652kb

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: 32ms
memory: 12548kb

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: 27ms
memory: 12244kb

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: 28ms
memory: 11916kb

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: 32ms
memory: 12184kb

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: 30ms
memory: 13304kb

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: 28ms
memory: 12648kb

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: 31ms
memory: 13508kb

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

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: 45ms
memory: 15764kb

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

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: 42ms
memory: 15600kb

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

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: 50ms
memory: 15768kb

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: 47ms
memory: 17612kb

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: 43ms
memory: 17424kb

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

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: 47ms
memory: 17352kb

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: 49ms
memory: 16700kb

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: 52ms
memory: 16756kb

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

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"