QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#541161#5254. DifferencesUESTC_DECAYALIAC ✓122ms29632kbC++201.4kb2024-08-31 18:46:582024-08-31 18:47:03

Judging History

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

  • [2024-08-31 18:47:03]
  • 评测
  • 测评结果:AC
  • 用时:122ms
  • 内存:29632kb
  • [2024-08-31 18:46:58]
  • 提交

answer

#include<cstdio>
#include<iostream>
#include<string>
#define RI register int
#define CI const int&
using namespace std;
const int N=100005;
const int mod1=998244353,mod2=1e9+7;
struct Hasher
{
	int x,y;
	inline Hasher(CI X=0,CI Y=0)
	{
		x=X; y=Y;
	}
	friend inline bool operator == (const Hasher& A,const Hasher& B)
	{
		return A.x==B.x&&A.y==B.y;
	}
	friend inline Hasher operator + (const Hasher& A,const Hasher& B)
	{
		return Hasher((A.x+B.x)%mod1,(A.y+B.y)%mod2);
	}
	friend inline Hasher operator - (const Hasher& A,const Hasher& B)
	{
		return Hasher((A.x-B.x+mod1)%mod1,(A.y-B.y+mod2)%mod2);
	}
	friend inline Hasher operator * (const Hasher& A,const Hasher& B)
	{
		return Hasher(1LL*A.x*B.x%mod1,1LL*A.y*B.y%mod2);
	}
}pw[N],f[N][4];
int n,m,k; string s[N];
const Hasher seed=Hasher(31,131);
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m>>k;
    pw[0]=Hasher(1,1); for (RI i=1;i<=n;++i) pw[i]=pw[i-1]*seed;
    Hasher all_f,all_k;
    for (RI i=1;i<=n;++i)
	{
		cin>>s[i];
		for (RI j=0;j<m;++j)
		f[j][s[i][j]-'A']=f[j][s[i][j]-'A']+pw[i];
	}
	for (RI i=0;i<m;++i) for (RI j=0;j<4;++j) all_f=all_f+f[i][j];
	for (RI i=1;i<=n;++i) all_k=all_k+pw[i]*Hasher(k,k);
	for (RI i=1;i<=n;++i)
	{
		Hasher cur=all_f;
		for (RI j=0;j<m;++j) cur=cur-f[j][s[i][j]-'A'];
		if (cur==all_k-pw[i]*Hasher(k,k)) return cout<<i,0;
	}
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 71ms
memory: 27268kb

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:

1397

result:

ok single line: '1397'

Test #2:

score: 0
Accepted
time: 108ms
memory: 29084kb

input:

4099 4100 2
ABABBAAABBBABBBAABAAAAABABBBBBAAAAABBABBBBABBAAABBAABAAAAAAAAABBABAABAABBAAABAAAABBAABBBBABAAABAABABBAAABBBBBABABBBBBABBABBAABBBABAAABBABBBBAAAABAABBAABAABABABAAABAAAAABAABABBBAAAABBBBBBBABBBAABABBABABBBABAAAAABBBBABAAABABBBAABBAABBBABBABBBABBAABABBABBBBABBBABAABBBAAABAABAABBABAAABABABAB...

output:

2964

result:

ok single line: '2964'

Test #3:

score: 0
Accepted
time: 115ms
memory: 29176kb

input:

4002 4096 2048
ABBBAAABAABBBABBBBABBBBBBBAABBABBBAABABBABBABBABBAABABBBBBAAAAABBBBBBAAAAAABAAAABBBABABAABBBABABAAAABBAABAABABBBABBBBABAAAABBBBBBABBBAAABABBABABAABBABAAABABBABABABAAAAAABABAABABAABBAAAABAAAAABBABAABBAAAAAAABBAAAAABABBABABAAAAABBABBBBBABABAABABBBAABBAAABBBBAAAAABBBBBBBABBBAABBAABBAABBB...

output:

3926

result:

ok single line: '3926'

Test #4:

score: 0
Accepted
time: 92ms
memory: 28704kb

input:

3892 4096 3072
CCBACBACABCBBCDBDBBDDABDADCDCCAABAAADADDCBABABACAACCADDDAAACBCDACCBDBCCCACACBBBCADBBDBABDACAABADBBBADADADBAADBCCDBDAADCCBDCBDBAACAABDABDAADBBCDDCADDBBDBDBDDBBDACCCCACBACCBADDCCDCDCCACBCDDCDCCCADCDDAADBBDABAADBDDDACBDBDDDBACDAABBBDDABACAACDAADBBBCDCCCAAAADDCBDBBCBDDADCAACCAABBCCBDBABCB...

output:

2870

result:

ok single line: '2870'

Test #5:

score: 0
Accepted
time: 90ms
memory: 29108kb

input:

4099 4100 2
CCCDDBDBBCADADBBACDCDDBACCDABADCDDDDBCDDABABDBCCCBCCCDDDCBAABADABDBCABDBDDDCBBCABCCBBDCDBCDCBCCCBABCCBABCDBBAABADCAACBBDDABBBDDBCBDDCCDCADDDBCBBDABCBDBCCCACCADBBDDDCBDCDACCCBCBBDADAAACDADCDDCAACADDCDBDDBBBBCDAADDAADDDDADDCCDCBDDBAACABDADCACAABCCAAACACBCDCBBAABCAACCCDABBDBCDABBDBCCCADBCAA...

output:

2128

result:

ok single line: '2128'

Test #6:

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

input:

4043 4096 3072
CADABDBABCBCDDDCABAAADCDBDDBBDCCBAAADCDCCBDAACABDBCAABCDADCCCACDBBABABCCDCCACDDABDADBACCBBCBDBABDCBBADADCBDDDDDDCBABBDCAABBCDBADBDCDBDBCBDDCABBDBCDCADABDDBCACABDCCBCADBBDCDCDCAAADBADADCCDDDADDAABDDDCDBCCBCAABDBCBACACCADDCBBCBCDACCCCCAAAAAAADDABBBBABADCAAADCAAADACCBBACBCABDDDDBCABDABAC...

output:

3952

result:

ok single line: '3952'

Test #7:

score: 0
Accepted
time: 62ms
memory: 20284kb

input:

2188 4100 1458
ABACDBABBDDDACBCBCBADACCCCBADBCBDBBCDBDADDBDBDACADABBBCBBAAADCDACADDCCDBADBDBDBBDCBBDDBBCDABDBCCCBDBADAABCADCCDDAACCADABABCADCCDCABCADBCCABADBCADAAAABDAACBAAADBCBBBBDDBCCCBCADDBDDBCADDAACACDDBDBCDCDBCDDBBCADDADDADCDDCDCDCAAADAAACDDABBCDCBDACCDACACCCACABDDCCCDCABACAAACCDABBDBCBDBCCBCAA...

output:

2090

result:

ok single line: '2090'

Test #8:

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

input:

85 96 48
AABAAABBABABBAABBBABABBABBBAAAABBABBBAABBBAABBAAABBBABABAAAABBAAABABABBBABAAAABBAABAAABBAAAABAAB
AAAABABAAABBBAAAAAABBBBAABBABBBBABAAABABAABAABAABBABABBBABBBABBBABBBBABAABBABABAABBBABAABBAAAABB
AAABBAAAABBBAABBBAAABAAAAABAABABAABABABBABBAABBBAABABABBBBBABAAABBBABABBBBAAAAABAABBAAAABABBABAB
...

output:

10

result:

ok single line: '10'

Test #9:

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

input:

99 100 2
DBCBDACCACBBBBCACCDABADCAADDBACBBADABACCCBDADCABBABDAACDBCBDBBDCCBACDDDBBACBABDCDDBCCCBBBBCBADABABDA
DBCBDACCACBBBBCACCDABADCAADDBACBBADABACCCBDADCABBABDAACDBCCDBBDCCBACDDABBACBABDCDDBCCCBBBBCBADABABDA
DBCBDACCACBBBBCACCDABADCAADDBACBBADABACCCBDADCABBABDAACDBCBDBBACCBACDDABBACBABDCDDBCCCBBB...

output:

2

result:

ok single line: '2'

Test #10:

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

input:

10 3 1
BAA
ABA
BAA
ABA
ABA
AAA
BAA
BAA
BAA
AAB

output:

6

result:

ok single line: '6'

Test #11:

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

input:

73 81 54
CABCABCBBABABCBCAABCAACCCBBCBAACBBCABABAABCCCBBAABBBACCABABACBBCCBACBCBCCACCBCCBC
AACBABBBBBCCBCCABCBBABBABCABAABCACBBAAABCCCBACBCABACCAABBBACCACACCACBBBCAABBBBABB
AAABCBAACABAACABCCABCACCCBACBACACBACCACBBCCAABACBCAACAAACBBBBABACAABAACCABCBCCBCC
CABCCAACCBACACBCCBBCABAABBCBBBCBABBBBCBCBBABB...

output:

69

result:

ok single line: '69'

Test #12:

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

input:

3457 4000 1728
CCAACADCBBBBCBDABADACDDCDACBDBBDDDDACCADAABCDADABDAAAADBCDABCDBBCADBDCBCACCDCDCBBABCAAACCCBBCAAADBCBADBBADAACCBDAACAACBBBBBDDCCACCDCBDADCBDBABBBACDDACCDDBCCDCACBCCDDCDBBCCBCCADCACACDCCCDBBBCBABCBACDBDAABCDCDBDBAADBDCCBBCDAABABBDDCCACCCAACDCBBBBADCDACCCDBBAAADBDBBBBADBCABDBCDCAAACBBBBA...

output:

2626

result:

ok single line: '2626'

Test #13:

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

input:

4097 4096 2048
CBABCCBCBCCBACCAABABACCCBACBCBABACAABAABBCAABCABCCCBCABCAABABCCCCACCCCAACAACBABBBABCAABBAACBCABBBBBBBBCACBCACABBABBBCCCBBBBBACABCCCBCCABCCCABBACBCAABCCABAACCBBAAABCBACBCCBCCCCCCBABABBBCBACCCBCABBAABBBAAABBCCCAACBBCCBCBBABACAABCBABBCBABCCCACBCCACBBBBCAAABAABBBBABACCCABBAABCAABABAABBCCA...

output:

3851

result:

ok single line: '3851'

Test #14:

score: 0
Accepted
time: 92ms
memory: 29280kb

input:

4041 4096 3072
CBAADCADBDCDAAACBDCCCBAAADBBCDDCBBABCBCDBAACDAAABDCCBADBDBBDCCBADACADABBBCCADCDDDDAADBCCCDAAAAADABCCBCDABCDCCDADBDCBCCCABCDCBDCDDDADDDCBACADBCAADDADBBBCAACDDCBCCDDBBBDBCCDABADBDBADCCCBABCDDCCCABDDDDBDDBBCBBBCCCDDDBCADCBDDBABBABCDDAACDBAABAADAACCBDBDCBADABCDDCADADBDACDDDAAACABDBBACDABB...

output:

2649

result:

ok single line: '2649'

Test #15:

score: 0
Accepted
time: 51ms
memory: 27992kb

input:

4000 4000 1
DBACDACCAADCABCCBAAACADACCDCBDCBADAAACCACBDDDBBACCAACABADADBDCCDCCDCBCDAADDDBBDDDAABBBCACCBBAABDCBBDABDAADDBADADAABBCACACDCDDACCBDCBACCBBCCBBCBCDDABDCCBCABCADBCDDAABCBDADACCCBBBBDBACDCDABADCCDBDDDCBCDADCDBDBDBABBDAACBBCADBABBDADADCBCAAAABABCBCBBDACACDAADBBDCBABDCDACAAAACDBBADABCBABBABDCB...

output:

175

result:

ok single line: '175'

Test #16:

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

input:

4000 4000 10
AAABABBABBBABBABBBBABBAABAABBAABBABBBAABABABBAAABABBBAAAAAAABABABBBBAABABBBBAAABABBABBBABAABAABABBAABAABAAAAAAABABBBABAABABABBBBBBBBBAABABAABAABBABBBBAAABAABBAABBBBBAABBBAABAAAAAAAAAABABBBBBAABABAAAABBBABAABBBABBBBABBBBABAAAAABAAABABBBAABBBBABBABBBBABABABBAABBABAABBBABABBBBABABBBABABBBB...

output:

3594

result:

ok single line: '3594'

Test #17:

score: 0
Accepted
time: 62ms
memory: 27960kb

input:

4000 4000 1000
CBBBBDADDBBACBACCACDAACCCBBCDABADDDCAAACDDADDABBACCCCDADCACDBDCADDACBAABCCABBCDCBCADDBDCABCBCABBDBDBAABBBDCCCCACCADBCDCDBBADACABADDCDDDCCBDCBAABBCADDBCABCDBBDDBDCDAACACAADABCBCDDADCDDCCDABDDADCACCDBBCAAAAAACDDDBDCBABBAADDDDCDCDABBABBBCBDBADBBCDDCAADCBCBADCCBAADABAABCDCCBCDCBDACACABCBB...

output:

440

result:

ok single line: '440'

Test #18:

score: 0
Accepted
time: 58ms
memory: 20600kb

input:

100 100000 10
ABBABBBBAAABBAAAAAABAAAAABBABAAABBBABAAABABABABBABABBABABAABABAABBBABBABBBBABABAAABAABAABBAAAAABABAABABAABBAABBABBAAABAAABBBAAAAABABAABAABBAABBBABBBBAAAABBABAAABBBBABAAAAAABBAABAABBABBAAAABAAAABABABBBBAABABBAABBBAABABBBAABBBBAAABBBAAAAABBABBBABAAAAABBAAABAAAABBBABBAABAAABABBBBABBBAAAAB...

output:

65

result:

ok single line: '65'

Test #19:

score: 0
Accepted
time: 54ms
memory: 20724kb

input:

100 100000 10
CABDDDBBBCBBDACDBCADDDCACBBBBBDDBBDAAACCDDDDACDBADBDDDABBBDDCDCDABAACDCCDCBDBABBADBDDBBBCAABDDBDACADBDBABCACDCAACBDBDBCCBCDBBABCCBCAADBCCBBCABCCDBACDCABBDCDADCDBADCDAACCCADDCCDACBDBCADCDDCDBCACBDCCAAACBACDCBABDACBACDABCDDAABCDDAAABCBBBBACBBCBADCDDDABCACDBADBBDCCCAADBBCDCABDAACADDCCDABB...

output:

44

result:

ok single line: '44'

Test #20:

score: 0
Accepted
time: 62ms
memory: 20652kb

input:

100 100000 100
BBABBAAABAABBBBAABAABAAAABAABBABAAABBAABBABAABBBBAABABBBABBABABBBBBBABBBAAABBAAAABBAABABBABAAAAAAABABABAABBABABABBBAABBABBBBBBBAABAABBAABABBBABABABABBBBAABAABAAAAAAABAAABBBABAAABBAAABBAABBBABBAABBAAAAAABBBBBBBABBABABBAAAABABAABABBBBBAABAAABAABBABABAAAAAABBBAAAABABBBAABBBAAABAAAAABABAB...

output:

86

result:

ok single line: '86'

Test #21:

score: 0
Accepted
time: 26ms
memory: 20592kb

input:

100 100000 100
CDDABDACADCADADABADDADADDDDCBAAAAABBABABBCBADBABCAADDBCCABBCCCCCCAADBAACDCDCAAACAABACADDBABACACBACBCCBBCAABABBCCCACAABDCCBCBBADCDABCCCACDBCACBCACBBDDABBBACDBBCABDCABDCBABCDDAABCBABCCCDCBDDCCAABCADCCBCADCDACBCABDCACCCDCCCACCBBDBDBCCCBABBDCADAACACADCCBACDCAACBAAACCBDDDCCDCDDAACADADBABAD...

output:

7

result:

ok single line: '7'

Test #22:

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

input:

100 100000 1000
AAAABAABBBABAAAAABBBAABABABABAAAAAAABBBABAABBAABABBAAAAABBAABAAABBAABABAABAAABAAABBBABBBAAAAABABBAAAABABABAAAABBAAAAAAAAAAABABABBBBAAAABABAABABABAABABBBBAABBBBBABABBBABABAABAAAABABABAAAAAABBABAAAAABABBABBAAABAAAAAABAABBBBBBAABAABBBBBBAAAABAAAABAABAABABABAABABBABAABAABAABBAAABAAAABAAA...

output:

20

result:

ok single line: '20'

Test #23:

score: 0
Accepted
time: 67ms
memory: 20696kb

input:

100 100000 1000
CDAAAAABCACBBAADADADDDCDDABAADDDCADDBAAABCBDDCCACCABBDBBDCCACCDBCDADDBDBAAAADCABBBCDAABACDBABBBDACDADCBDDBDCAADBBCBCCCCBBDCCADCBCBCBADBDBBBCBCDDABBDDDAADCDACCCAAACAAADBBBADDACDBDCADDBCCADBDBCDBADCBCACAACDABCBABBABCCDDCACDCBBDADADDDDDBDACBBDDCDABCDBAADACBBBCBCCBBCBCBBBDCACBDDDCCACCACB...

output:

68

result:

ok single line: '68'

Test #24:

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

input:

100 100 1
BBBBBAAAAABABAABABAABABBAABABAABAABBABBBABBBABBABBBAABAABBBBABAABBBABBBBBBBBBAAAABBBABBABABBAABBABAA
BBBBBAAAAABABAABABAABABBAABABAABAABBABBBABBBABBABBBAABAABBBBABAABBBABBBBBBBBBAAAABBBABBABAABAABAABAA
BBBBBAAAAABABAABABAABABBAABABAABAABBABBBABBBABBABBBAABAABBBBABAABBBABBBBBBBBBAAAABBBABBA...

output:

68

result:

ok single line: '68'

Test #25:

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

input:

100 100 2
CCBAACBBACAAABCBAABACBBBABBCAABACBBCBCACCACACACABBABBBABACAACABCBABBABABABCACCBCCCBACBBAACBBBACACACC
CCBAACBBACAAABCBAABACBBBABBCAABACBBABCACCACACACABBABBBABAAAACABCBABAABABABCACCBCCCBACBBAACBBBACACACA
CABAACBBACAAABCBAABAABBBABBCAABACBBABCACCACACACABBABBBABACAACABCBABBABABABCACCBCCCBACBBA...

output:

47

result:

ok single line: '47'

Test #26:

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

input:

100 100 60
ABBBAAACABCACBDADBBAABAAACDDDDBBCCBCBAADDCCBCBBCDBDDBBBDBABBCBDACCCACBAABCCDBBDCCACBDBCBBCBCADDACBAA
CDCABBBABCBADBCCDABCCAADBAAADACCBCDDBDCBDCBCBAADCABCDCBCCDCBBBDBABDBABBDBDCADDACABADBBACCCDCCADDABDC
DDABAADCBABCBDBCDABDCCCDDAABDCAACBBCDBBACDDCBABDCBABDBBBCAAACCDABBDCCBCACACDABDACBCDDBB...

output:

86

result:

ok single line: '86'

Test #27:

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

input:

100 10 5
CCCCCACABA
AACCCBBBAC
ACBAACBBCB
CCBCCACCBB
CBBCCCABAB
ACACACBBCC
CCCCABCACB
ACBCBAAABC
AACCBCCBCC
AABBBAABBB
CCCCABCCCB
ACABBCCBCB
ACACCCCACC
ACCBBCBACB
BAACAAAACB
ACACBAACAA
ACACCACABC
BCCABACBCC
BCBBCCABCA
ABCBCACBBC
AABCBAACBB
ABCCBAAABC
BCACBCAACB
ABCCBABCBB
ACAAAACCCB
BBCCCABAAB
ACBCC...

output:

68

result:

ok single line: '68'

Test #28:

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

input:

10 100 4
AABBBBBAAAAAAAABABBABAABBAABBBAAAABBABABBABBBABBABABAABBBABAAAAAAAAAAABBBBBBBABABBBAABBBBBBBAABBBBAB
AABBABBAAAAAAAABABBABAABAAABBAAAAABBABABBABBAABAAAABAABBBABAABAAAAABAABBBBBBBABABBBAABBBBBBBAABBBBAB
AABBBBAAAAAAAAABABBABAABAAABBBAAAABBABAABABABABAAAAAAABBBABAABAAAAAAAABBBBBBBABABBBAABBBB...

output:

10

result:

ok single line: '10'

Test #29:

score: 0
Accepted
time: 56ms
memory: 23336kb

input:

3456 3456 1728
DBBADABACACBACADAACBABDDABADDDDBAAACDDCAACBBCCDCDDDACDADCBBBBBBABDCDCCABCCDAABDBBDADAACCCBCCCBDCACDADABBCDBBBBAADDADADBCABCCABCAACBADDBABDABCCABDCADBADDBACDCADBDBBACCCBBABBBDDDADDDBCCDBADCABDBCBCDDBDACCCDCBDDADCCBBCBBAADBBCBAADABBABBCCCACCBBCDADDDADCDBABBBACACBBDABCBBCCCDACBAABACCADAA...

output:

1330

result:

ok single line: '1330'

Test #30:

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

input:

4096 4096 2048
BABBBAABABABAABAAABAAAABBAABBABBBABBABABABAAAABBBBABBABABAAABABAABBBBBABBAAABAAABBAAABBABABBABAAABAAAAABBAABBBAABBBBBBABBAABABAABBAAAABBBAABABAABABBABABBBAAABAAABAAABABAAAABBAABABABABABAAABBBAAAAAABBBBABBBBAAABABABBAABBAABAABBABABAAABBAAABBBBABBBAAABAABABBBBBABBAABABABABABBAABBAAAAABA...

output:

2121

result:

ok single line: '2121'

Test #31:

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

input:

4096 4096 3072
CDDDABADADDDBBCCDADBDAABCADCDAADDADDBDCDACCDDDAADCAAACACBDDACABCCCCCAACBCDCBDDCBDBBDCDCCBCABCBDBCCABBAACAADBADBBADDCCBDBADBBCCBCBDAACAABBCDBAADCADBCABADCABDBAACDDBDBDCABACDDDBBBDBBAAABAAADABDAAABABBAACBAABADBDBBADDABDADABBDDAACCBCDCDDBBDBDADBADBBACCCDBBCBCDCACADAABBAACCCABCDDDAACDBAAC...

output:

2705

result:

ok single line: '2705'

Test #32:

score: 0
Accepted
time: 92ms
memory: 29552kb

input:

4096 4096 3072
ADCABDBCBDDADDDBBDCCDAABBCBDCDBCCBABBACBADACCDABCCDBDCDCBBBDBCBDDAADCCCACBCDBBABADCAADBBBDADCCADCDDADAABADDCDBCCBBADBBACABDDACACDBDAAAADBACCADBCCBCBACAABCAAABBDCCBBCCCABDBBDDABAACCACCBCADDACAAAACCABDADAABACDADDDBCBBADDDABCDDADDCBBCDBBBCDAACBADADBDABABBDCAACADBCCCABDCDCDABCDBDCAADDBDAA...

output:

2670

result:

ok single line: '2670'

Test #33:

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

input:

3863 4096 3072
DADABACDDDDBACDABBBDDDAADCAABBBBACDAADACAABDDABACDDDDDABDCBBBCCDADDABBCCDCACACACAADBDCBCBDCACCACCCAACABDBCBACAABAADABDDACCABABDACBBADDDADAAAACDACAABDDCDBBCBDCDBAADBCBCBABDADCABABDBADBCDBADCDDDACACBCABDBDBBAADCDDDBCDBBCCBBBDABBCACCABCCCBABAAADDDDBCDDCDCBACCCDDBBCBADBACBBDBBADDCABBCBBAB...

output:

3572

result:

ok single line: '3572'

Test #34:

score: 0
Accepted
time: 56ms
memory: 27288kb

input:

3585 4096 2048
AABBABAAABAABAAABBBBAAABAABBABBBABAAABBBBAABBBAAAAAAAABABABBBBAABBAABAAABBBABBBABAAAABABABBABBBBBAABAAABAAAAABABABABABBABBABBAAAABBABBBAAABBABBBABABBBABAABAABBABBBBBBAAABBBAABABBABBBAABBBABABBABBBBBBAABAAABBAABAABABBAABBBBBABAABBBBABBABAABBABBBBBBBBBBBBBBBABABABBABBABBBBAABAABBBBBAAAA...

output:

444

result:

ok single line: '444'

Test #35:

score: 0
Accepted
time: 83ms
memory: 24720kb

input:

3073 4096 2048
BAABBABABBBBBABABBBBAABAABAAAAAAABBBBAABAABBAABAAAABBAABAABBBBABBBBBBAABAAAABBABBBBAAAABAABAAABAAAAABABBBBABAAAABBBBAAABBABBBBBAAAABAAAABBABAAABBBBBABABABBBBAAAAABBBAABAAAABBABAABABBBBABBABAABBAAAAABBAABBABABAAAAABABBBBBBABAABAABBBBAAAAAAABABBBAAAAABAAAABAABABBBBBBBBBBBABBBBBBBABBBAAB...

output:

2584

result:

ok single line: '2584'

Test #36:

score: 0
Accepted
time: 58ms
memory: 26996kb

input:

3515 4096 3072
CDDBBBDABCDABBADBBBCADDDABDBBAAADCBBDDAACCBCBDCABBBBDCBADACDAACBCCCDBDDAADBAAADABDCABBABADDCBBBBCACBDDCBCABCCBDDCCDBBCAAADBCBDDDCCDCADCCABADABCCCCBDBBABBBBDADCAABABCDBADCAACBABDDCBACABDCDDCABCDCCDBBBBABDBACAACBBABBCCDCBDBADBACCBDBAABCADDCADAACACAABBACACCAAABADAAADDADCCCCCCAACCDAAACAAB...

output:

829

result:

ok single line: '829'

Test #37:

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

input:

100000 100 10
BABBABBAAAAAAABBABAAAAABAABBBBBAABBAABBBAAABABABABBABAABAABABAABABABBBBAABBAAABABBBAABBBBABABBABAAAB
BABBABBAAAAABABBABAAAAABAABBBBBAAABAABBBABABBBABABBABAABBABABBABAAABBBBABABAAABABBBBBBBBBABAABBAAAAB
BABBABBAAAAABABBBBABABABABBBBBBAABBAABABAABBAAABABBABAABBBBABBABAABBBBBABBAAAABABBBB...

output:

1078

result:

ok single line: '1078'

Test #38:

score: 0
Accepted
time: 70ms
memory: 21684kb

input:

100000 100 10
CAAACDCDCADACDDCACBCCBABADDDDDABBBCBABACBAAADDCABADAACBCBBCBBCDACCCADDDADDACADDBACBCBDBCADACBDCBBBBA
ACAACDCDCADBCDDCACBCCBDBADDDDAABDBCBABACAAAADDCABADACCBDBACBBBBADCCADCDADDACDDDBACBCBCDCADADBDCBDBBC
CCAACDCDCADBCDDCACDCCBDBADADDAABDACBABACBDAADDCABADADCBCBACABBDBDCCCBCDADDACDDDBACBC...

output:

59854

result:

ok single line: '59854'

Test #39:

score: 0
Accepted
time: 67ms
memory: 29304kb

input:

4038 4096 3072
DABCCADCCABCCBCDACDBDBBDCADBCCDBAAAAACADCBBCAAABCABABDCCDCBADBBBABACCAABBCCCDBDCADADDBBCCDDCACCADADBCACBCDBCABCDBDBABDBCDCDDDABBBBCDACBACCDBBDDAABADDBBDDCDADDCBAAABCDCDCDBCBACCCDACACBACACBCCADDDABAADABBDBBDBBCCBCBBAACCCCDADABBBACADACCCADDDDCDBDDCCCBCACAACACCDBAABACADBADCBACBCBDDDBBABD...

output:

1675

result:

ok single line: '1675'

Test #40:

score: 0
Accepted
time: 83ms
memory: 29240kb

input:

4022 4096 3072
CDCADABBADDACACAACAADDCCCDBCCABCAABDBDBDCBADBACBBDBCCBCDBACDACABCDCBCBADDDBCCCCADDCBBCACCACADBABCDBDDCCBADACCBDCCCBDADBCCDBDBCDCAABCCBBBDABDCBDBADCCBDCDDBABCDDDACBCDCBDBCCDBCDBBDBBBBDAAABDBDDBADCABCDDAAAAACDABDBCADCDBDADCCDCBCCCDBBCBBADACCBDACCBACDCDADDBDCDCDCDADDCAABDBDAAAAAABDDDCCCD...

output:

2084

result:

ok single line: '2084'

Test #41:

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

input:

4033 4096 3072
DBACDBABBCDDACDAABCAACDBBBADCBBDDBBBADCBCDABCBAABDCBDCDCBDDCADDCDCAACCBBACDADBDABBACBCBDCBBACCDBDCBABDAADACBADAACAABDDDDDCDBCDCACDBABBBDABBADDBAADACAAABCBDBCBBBBBDBBBACCCACBBDADDAADBBDDCCBABCBBCAADBDCBDCCCCCCCCBCCDCDDAAAADDACADAAAADDDDACBDCADBCBCAACABABBABCCCAAAABCADBDDADCCACDCBBDCABC...

output:

1585

result:

ok single line: '1585'

Test #42:

score: 0
Accepted
time: 79ms
memory: 29272kb

input:

4031 4096 3072
BDCADCDCBDDBDCBDBADDAABDABCDDAAACABCDDCDCCBABCDDCBBAABCACBDBBADCABBDADBCBDBCDDADAABDBACADCACDBBDBCCBACACCDACCCDDBBDDACBBACCABDDAABCABCBDAADCBADDDBBADDCCDDCDCDBBCCCCAACAACDBACACBADCBCAAAADCBDBADBDACADCCCDACDBADAADCACACDCADDCDCDBDCCCADDCACBCBCACDDBDCADDDDDBCDCADDBABBDABBCBADACCACDCADBCB...

output:

2643

result:

ok single line: '2643'

Test #43:

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

input:

4030 4096 3072
CADBCAADADCABADCDADCDAABBCADADCCCCCABCDCADCDBCCAADADDAAABCADBADABBACCABABDDDADADBCDDADBADCCDCBABDACDCDCACCABBBDDCBCBDAACDCBACCBDDBDAAAAABCADBCCCADCACBACBAADACDCBCABCDBABDBCDDDCACDBADDDCCBDBDBACBDACABBCAABBCBCBDBADCDCDBAAAADCDDDCADABBCCACCCDDBDBBDDCACABABBDCCADCABADCACDBBBBCABABDDADCCD...

output:

1950

result:

ok single line: '1950'

Test #44:

score: 0
Accepted
time: 34ms
memory: 16604kb

input:

3455 1728 864
CBCCCCCCCBBCBBABABBBAABBCCAAAACAABAABBACBAACBCBCCCABACABACABCAACBBBBACCBBBBCABACBBBBCAAAABCBCBBACACACCAABCBBAABABAACCACCABABBACCCBCAAAACCABCCABCCCACCBCABCCBCABACAAACABBABCCAACBCACCCABCABCAAAACBAABABCACCBBABABCACCCBACBABCCBBBACCBCABBBAACCCACBCCCACCABCAABAAAAAACBBBBCCBBABCBCCACBAACACBCBB...

output:

2126

result:

ok single line: '2126'

Test #45:

score: 0
Accepted
time: 68ms
memory: 29072kb

input:

4095 4100 1024
BBBBAABBBABBABBBABBAABAAAAAABABBBABBBBBBAABAABABBABBAAAABABAABABBABBABBABBAABBBBBBABABABBBABBAAAABBBBBABABBBBBABBBABAABABBBABBBAAAAAAABBBBBBAABAABAABBBBBBABABBBBBBABBBBAAABBAAAAAABBBAABBBABBBAABBBABBBABBAAAAAABABBBABBAAABAAAABABABABBABBBBBABAABABAABBAABAAAABBBBAABBABAAAABBBAABAABABABB...

output:

1043

result:

ok single line: '1043'

Test #46:

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

input:

2047 4100 1536
DBDAAABBBABDACBCACACBBADDCBDBCBBDABBCBDDBCCDDDCBABBDCBDBBABDDBDCADACBCDACCAAABABCAAABABBBDBACABDADCABDDBDDDCCDCAABCDBCADCBDCCCAADCCBBDDBCBBDBABCCCAADCDACACBACABBDCADBBBAAAADADDDBDBAADBBCCBBABAACDADBCCCBADADCBCCCCAAABDAACABABACBCDABBBCDDADCADCCBCACABACCACCCCBDCDDBACBCCCAACAABBDDDACBDBC...

output:

600

result:

ok single line: '600'

Test #47:

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

input:

2047 4100 770
BBAADADBCBBDCBDACBABBCADDDCCBDDBDCBDCACDCDDDBDACBBCCABBCDDDBCDDDDDAACBADCCCDACCCDDDBADCCCCDCAABBDACBAACACCCAABCCCDCDBDCDADADCCDBDCBBCCBAADDCADCBBCBDCBBAACCAAAACCBDCABBAACBACADCAAACABDBCCBDAAADBCBBABBCBBCDCBCABCCCBBCCCCAAACABDBBBACAACBACABAACCDBDDACCAACDAABADAACBBBABCACABAABCAADCDDCBACB...

output:

907

result:

ok single line: '907'