JOIN
Get Time
long_comps_topcoder  Problem Statement
Contest: Marathon Match 17
Problem: ContinuousSameGame

Problem Statement

    SameGame is a simple game played on a grid of colored blocks. Groups of two or more connected (orthogonally, not diagonally) blocks that are the same color may be removed from the board. When a group of blocks is removed, the blocks above those removed fall down into the empty space. When an entire column of blocks is removed, all the columns to the right of that column shift to the left, filling the empty columns. After the columns are shifted left, the empty columns on the right of the board are refilled with randomly colored blocks. That is, for each empty column after shifting, the entire column is filled with new blocks.



Points are scored whenever a group of blocks is removed. The number of points per block increases as the group becomes bigger. When N blocks are removed, N*(N-1) points are scored.



The board will be between 10 and 100 columns wide, and between 10 and 100 rows high (each chosen uniformly at random). The number of colors will start at between 3 and 7, inclusive. For every ROWS*COLUMNS (i.e. the number of blocks on the board) blocks removed, the number of colors will increase by 1.



You will play the game by writing a single method, move. The move method will take a String[] giving the state of the board, and should return the location of a group to remove. The move method will be called repeatedly, until there are no valid moves left. Each character in the board will be an uppercase letter (representing the colors) or a '.' representing empty space. The first element of the board represents the top row. Your return should give the coordinates of one block in the group you want to remove. The coordinates should be given as a int[] with two elements: {ROW, COL} where ROW is the 0-based index of the row the block is in (0 is the top row), and COL is the 0-based column index (0 is the left column).



To compute your overall score, a somewhat complicated method will be used. First, the mean and standard deviation of the top 20 scores for each test case will be computed (all submissions will be used when there are less than 20 submissions). For each test case, the z-score (number of standard deviations above or below the mean) will be computed for each competitor using this mean and standard deviation. A competitor's score for a test case will then be 10+z, or 0 if this value is negative. The overall score will simply be the sum of these scores.



A visualizer is available.
 

Definition

    
Class:ContinuousSameGame
Method:move
Parameters:String[]
Returns:int[]
Method signature:int[] move(String[] board)
(be sure your method is public)
    
 

Notes

-A search for SameGame will turn up many versions of the game that you can play.
-There are 60 non-example tests.
 

Constraints

-The memory limit is 1024M.
-The time limit is 30 seconds.
 

Examples

0)
    
There are 5 colors on a 14x49 board
DEEEBDDEDCDCECCBEBCAEEEDDCCAEABDAEAAEAACCCCADACCD
BABADEEEABBDDBDEADEBADCCCBBCDCBDAEEAEACBEADABBBAE
CEAEEDDDCCABDCBCAAEDDABBBBEEEDBAAABEBBBDDBCDAEACD
ECDCBACECCEBCEDBBBDACDCABAAEADAAABDCDECEBADDACBAE
BBCDDCCCCDAEBBEDDDDEAEEECADABBDBAAABEEDEBBEDECDDC
BCEBEDDEBCEAAEBABADCBEDCABDAADCEBDDBDDAEBDBDEDBBB
EDBEAAECABAEDAEEDDDBBDBBDDBDDEEEECCDEEEBCAEACDDAE
BEDCDCDAEEACEEADCBCCDAAEEABACCACCBBBDEEBEDCDCDECE
EAEEDEBDDEABDDEDECAAADEBDBEEDDBAEBECDDEEEAAADDEDD
DCDDECDBBAAAECCEBCBECACAEBEAABACBBEADDDBAEEAADDDB
EDEDCCAECEDACBCCBBACDAEEBCBAEEDCBEABAEEEDBEEAEDAA
DDAECDBBEEABDEBDCADCCEBCECAEBBADBDDCDBADEBEECEBAB
DABCDADBDBBDCAAEEBACDEACBDAEDDBAACEBCBDCABAEDEDDC
CEDCDEECBAAAEDCABDDCBBEEBDECAAABEBCEDDECACDAEDBCB
1)
    
There are 3 colors on a 15x81 board
BAAAABACCBACCBACCAACBBABCABBABCBCABBCCBCBAABABCCBBBCBABCCCBBACCABBCBCABCABAABABAB
BABACCABACABCBBCAACAAABBCCBCBAAABBCBCABBBCCBBABBBBCCABABBBBCBBBABBAAACBCCBCBACCCB
BCCCABCCAABBCAACBACABCACBBBBCABCCACCCABAABBBBCBBACABACBCBBAAAAACCBACCCBBCBCBACCCA
CABCCBCACBBBAABBCBBCBACABBCAAAACAACBBABBABABAAACBAACBAAACACBBACBBCAABBAABACACCBCA
BAAAAAABBCCBACABABACAAAAABBABAAAAABBBBBBACCACAACCBBBCBABACACBACACCCCCABCBBCCAABBA
ABACBBCACBCCBCBABCCBCCBAAAABBCCABCACABAABABBABCCBBCABBBBBBCCCBBACBACACBABBBCAACBC
AABABBBCACACCBBBABACABBAABCACAABACCBCACBBBBCBABBACACCABAAABBABCCABACCCABACCBCCCCA
BABACCABABAACACCBABCBACCACCBAAACACBBCBBBAAACBCBBBBCBABAAABBCCBBACCBCBBBACACCABACC
BCCBCAAABCABBCBCBCCCBCCCAAAAACCBAAAABCBCBABCBACBABCABACACBCCCBAAACBACAAAABACCBBCB
CABACABABABCBCBBCBAABCBACCBCCACBCBCCCBBACBCCBCCBCBAACAACACBAABBBABBCBABACAAACBAAB
BCBCBACACBACCABACACCCABCCBBACCCABCCABAAABABACACCACCBBCACBBBCACCBBBBBBBCBCBBCBAAAB
BACAAACACBBACCCBCCABCCCACACABAABBCCACBACBCCACCCCBBCBABBCAACCCABBCBBAACAACAABCACAB
ABCCCBBABCACCAABCBCCCCCBACACACABCAABBCBACAAACBACCABABBCCBBBABCBAACACCBCABBCCCABBB
ABBBCABCACBBCCABCCCBCBBCACABBAABABCCABBABAAACBACAAABCCBACBBABBAACACBAAACAAAAAABCC
AABCCBCACCAACBABABACCABAACBCCCBAACABCCCACCCABACBAACBABCBCCCAACAABAAACACACCABCACAA
2)
    
There are 3 colors on a 15x22 board
BAAABBBABCBABAABBBABCB
BCCCCCCAACAAAABBCCBCBC
CBCAAABABABAACBBCBABAC
CCCBABCCCCBCCBABCCCCBA
BCBCCACABCBCCCCBBACBCB
AAAACACAABCBABACCBBBBA
CACACCBCBCCBABCBBACACB
AACACBBBABCBBCCBAABCAA
BBBBBBBAACABBACCCAABBC
CAACBAABBCCBCABACCCBBB
BBAACABBCBBCAAACACCBAC
CABCAACAABCCACCBCACBCB
ABABBCBCACABAACCCBAABB
BCBCBCBBABCBBBCBCCCBBA
BCCABBBBCACCACBABACCBB
3)
    
There are 6 colors on a 13x54 board
EDDBEABCCCCCABAEAFFEBBDDDFFEDACDBEFABAEFADECFEACFFABCE
DEEEAAABDDDAFBCDFDCBDEFBDFCACCCCBFBEBBDECBAEAEEACDABFB
CCFEDDDDAACCFCEACFAEBDDBDBEBBEBFCEBFCAEFCEDBDACDBFABDA
CBBFAEDBBECEADDADCCCADEFDBBBECFCEFEADEFFBFECDCEDFDCBFB
DDFEFDDBACADEBAECDDCACBEFDFCBFEDCDACADDFCFCBECAFAABCDC
FFCFBFAFCFCCCCEFEBCEAECBDBCDDDCAFDFBBFCEEBADEABDEDFFCE
CEACBDDDAEEACDEFFEEBABCFFBFFDFAEFDBFEACDFCBDBAFBDBCBBB
CCDBECEEFCFBAFFBAAAAFFFFAFCFCAAEAFADDFDDFAFABAFABAFABC
CDACAADBFFCEBDDDEEAFFCEDBCCFBFFCCBCAACECDDEDCCDEFEACDD
DCFBFAACABABEBABFBBFBDDFEAEAAFCEDCCAFBCFFDDBFACEACFABB
EEACEBACDDDABCCDCBDACADCBAEDEEEFCCCBCBBAFABAEACAEADBDA
FDCDDCDEABFFAABAEBFFBDCBDEEAEFFDCDBCAEAEDDBDEBFBAFEAAF
EAEEACCADEDDFCCFCBAEFBACFDEFBACACEBEBAAADBEBBFDCCDDDBD
4)
    
There are 7 colors on a 12x49 board
AEABFFFCDDEGACDFCGGBCEDACCBCGGCFFECFGFBDFGGGFGAEG
BAGADCFEGADFAECFBFACBCECCCEEEBGEDAAGEGBEBFFCGBDFD
CFBABEBEEBEGCDEAEGBBCGDCAFAGAFGEBGCCBBDECDBFBFBBC
CDFGAGFBCACGCACGBDCEBBCDFAFCEEGCCGBFEEAADBGDACCEG
BGECAECBDFEFCBAFGDDAAFFABCFAGEBECCDDBBFCGGEDDBAFD
GEDBFFEEEFCCFCEEGCEFFCGAADGCGCEBAFBCGBBEFABFCDGBF
GBDDBFFBABGBGAEDDGCGGEDDCBGABDGACGGFEFECADGBFFGGA
AFDDEGEEGDEEGDCGBGEFFFBEBAEEDDDFEABBGFCFBEFGGBDCA
BDEEFCGFBEFACDACFAGAFGCEFBGFDBAEGCAAAFFACBADADCAG
CGCEGEEADGDCABCEEGFACDFABCDABBECDFBCAAEAGCBAFBDCD
GBBDGDDAFGCFFAGBCBCEDDDACADDFGDAFCEABCCDGGFFGADFE
ADGGDBDGCGCBGGFAEBBFFDCBEDCCGAAAGFDFGACADBEEDDCEG
5)
    
There are 4 colors on a 14x81 board
ADDAABCCACCDAADDDCCCDBADCCACCADCABACDBAAABCBBCBBABBAAABBBBACBBBACDCACDCACBACDDACC
ACDADABBACCDADCDCCABCDDBCDAABCDBAADADADADCABDBDBAACCABCBABBABBCADBDBCADBDAABCCBAB
CDBADBDABDCDBDCCCDBBCBDBDAABACDCACBDDAACABBCABCDBAABCBADCBABDCCAACBBAADCBABADBAAB
CACAADBBCBDBBDDDCADDBBBABBAAACACCDCACDCBABADDDACACBDBCADADACBDCDBBAADCDDAACDBABAC
BDBCDBBDDCCDACABBCBDCBABCCACBCBBCADDAABBBCCBBDCDCDCDCBADCDAABAACCDCBADAACBABBCCAB
DDCDCDDCACABACADCABADCABBCDCACDCDDAADDBACACBCACBBABCDBAADDDCCDDDDACBBADBABCCDACCA
DACDBBBAACADCCACCBCAAABBDADCABCABABADACBACCCCBAACDDCDABDBBBCCDCBACBDBABADBBDBABBB
CCDDDBBCABBDCCACAABCCAADAAAACABACCBDBDDDCDDABCDCBAAACDDCADDDBAAAABCABCCCADDAAACAD
DADDBDDBCCACCBCBDDDABCCDCACADABBDCAAACCBCCDCDBACACDDADDACDDCDBBBABABDBABBDCAAADCD
DCDDDBDBAACBBABCAABABCCBAADDBDBDAADCDBBDADDCCCCDADBAADABCACCCBAABDDDCDBCABBABCCBA
BCBBDDDDBBCDCABCCCABBDDBDABADABCCCCBAADDBBACCDBCBDAADCACBCDDCADCADAAABADBBBBAAADA
CCBCAAAACDADDDDBBBCBBBCCCCCADACDBCBCDCDCDBAACDAADDADBCCBDDBCDBBBBCDADDABDDDDACDBB
CDDBBDDADDBBBCCBDBDCCDDDAACDDBCCACDBCDCBABDBADADDBABBCBBDDACCCCABBBABDCAADDDCCADD
CAAAABADDAADDCDDBDABBBDBADBBBDACACCBAACAAADCCAAADCDBCBCCDADDBDACDBBBCBDACBDBAAABD
6)
    
There are 3 colors on a 13x22 board
BBBBCAAAAABBBAAAABCABC
CABACAABAACBAACCCAABBB
ABAAAACBBAAAABAABCACBC
CBAABCAABBCBAABBCBACCB
BBABCAABBAAABBBCABABCB
ACCCBCAAAABCAAABCCAACC
CBBCABBAABBAACCBCBABAA
BCAACCBAACCCACBCBBBACA
CBABBAAACABCACCABBACBB
BBAABCACACBBAABBABBACB
BAABBBBBACBAAAABAABAAC
ABABCACCACBACBACAABAAC
CCBCBCBCCAAAACBBACBABB
7)
    
There are 3 colors on a 11x54 board
BACACCAACCCBAABAAABCBCABAACCBBCBBCBBACABBCCBBCBABBBACB
CACBACAABCCACBAAABACAACABABABBCBACBCAACBACABCCCCBBAABC
ACCBCCCAAACBAABCBAABABAAABBACBBACAABBACCBCCABCACABACCC
BCBBCCBAACCABCBBCBCBCCAAAACABBCBBCACCCACBCCACBACABACCA
CCABCABCAABBCBCBCCCABAABBCBABCBBCACAAABAABABCACACABBCA
BCBAAAABBBABABCCAABCBBABAACCCCBCBBCACAACAACBBAAAAABAAC
ABBAAAAABBABAABBACCBBBCCCBBCBBCCCBBBAAACABACCBAACABABA
CCCBBBCCCBCCACBCCABABCCCAACCBBACACCCABBACACCBCABACAAAC
ABCBBCACACAABBCCBCBCABCABBCCCBAACCABABAAABBAACABCBAAAC
ACBABBBBACABBCBCACCBABBBAAAACCBAABACBBCCABBAABACCCBCCA
CBAAACCBBAACCABAACCAABAACACBBABAAACCAABCABCAABCACBCCAB
8)
    
There are 6 colors on a 10x49 board
BFDFABBCEEEFCFCFABECEFAACDBAAAECCFDDFECACCFCFFBEE
ABAACCCCADECFDFEAFACABFDCBAAABACBBCEBADECECBBBEFB
DFEBDFFDDCCDEDCBDDEEBACBCCFFEFDDBBDBBCAABBAECABEC
ABFFEDCCFEBAEEFAEDCDFBEADAACFBDCAACCACDECDCAAFCFD
DCFFCEDBBBFEBBACABBDBBFBBDBCCECDEAEFCCACBFDAFDFEB
DCEFDFFDCBCCEDCDAFDCDDEDDCBFAFFACFAFBEFCACCFDABDE
ADEABABDCAEEECBEFBBCCCAFFCCEBBFEBBCADFABABCCFFAFB
BBBFCDAFEFCABAECCAADDBFBCEDFCCBDDBBDFAACAEBAFACCC
CAABFDDCDEAABFBFBBECEAEAFCAACACFCBFCDACEFEFBDDACB
AAACADFFCCDABEAEAAFADFAEBFFDFECFCDCABEBAAAEBBADEA
9)
    
There are 3 colors on a 81x82 board
CBBCBAACACCCCBACBBAACBCCBBBBCCBCCBCACABAAACAAACABABACCCBBABCBBAACBABCBACCBBBCBABBB
CAAAABACBCCAABBCBCCCBCACACCBABBCABAABBCBACCCBBCCBCCBBAAAAAACABBAABCCACCCBACBAABABC
CCCABBACABCACAAACCBABBACBABABBBCBCBCABAABCABABCACACBBCCBABCBABCBABCACBCCCACCACBCCA
CCBBAABBBBAACBACCCCCCACBBCCACBACCCCCACBAAABCCACBBACACACBCBAACBCACCABCACCCAAABAABCC
AACCBBBCCBABCAAAABBCABBAACBBACABAABACBCAAACABCBCAACBCCAAAACCBBCBCABBCCBBCCBCACBCCB
ACCCACBAABBAABABABBACABAAABBBABCACABBCBCBABABABBABCCCACBCABAACCBCCCCCAABABAABBBAAB
CCBABBBABCBBBBACCAACBBACAACCBCCBCAACBBCAABBCCAABBBBCBABBCBCCCAAACAAAAACABAACAABCCB
ACBBCCCCCBCBACACACABCABABBACBBACCBBACBACACABBABBABBBACABBBBCCBBCCABBCCCCBACBAABBBB
ABACCBAABCAABABBCCAAAAACBACCAABBABBCBCAACAACCABABBCACBBCCAAAACCCBABBAABCBCAACABAAC
BABBCBCCCABCCACBBBAAABBCBBCABACBCAAACBCCCCACABACCBCACAACBAACBBCACBCCAACABBCCBBCAAC
BBABCCBAACCBACBAAACABBBACABCACAABCABBCBCBABCAABCACACBCCAABCCAAAACCCAACBABCBABCBABC
BCABBBCBABABCCBCAAACABBCCCBABBBCBAACBCAAAACBCCBCABABCABACCAACBABABBBCACCAACBACBBBB
AABABACAABAABBAACCAAAAAAAAACCBAACCBAAABBCAACBBBACBACBBABAACAABBBBCCAACBABCBBABCCCA
BABCBCCBABCCCBAABCCBACBBBCBAAAAACBBBCBABBBCCBAACBBACCABBACAABCCABAAACACBACCAABBBCA
BCABCBAACCABACCAABCABAAAABAAAACABBAABCBCAACCCAABBABCABABCBCCCCAAACCABBCBACBCCCBABC
AAACCAACACACAABABCCBCBCABBBAACABCACCBCBACBCABCCABCBACBACBCCBBACCBACBACBABBAABACCBB
CCCCBBACCACAABBCCCCAABABBABCBABBABACCBBAABACCCABCCACBBCACAACABCCBBBBCBAABCACCABBAA
AABBACCCBBBCAACACACBCCCCCAACCBCBBCBCCACBCCCABBBABBCCBBBABCCCBACAAACCAABACBBBCCABCB
BCCCCCACBBAABABBCCBCBCCAAABBCACCBABABCBAABCACBBCABBCAACBBCCBCACAABCBABBCBACCCABBAA
CABCACCCCACACCCCCCAACBCBBCCBBCCCCBCACAAAACCAAAAAABACBCCAACBCABACCCACBABACCAABCBACC
BCACBCBCCCABABCAABACCCBABCAACCCCACAAAACBCCBAAACACBCBCBABCCCCCCCCAACAABAACCABCAAABC
CABCACABACBABAAACBBBBAABCBBBABAACCCCBCCCBCABCABCABBACBBCCABABBBABCACCBBBAABCBBABBA
CCCBBCBACCCCCCBCBCCAACABCBCAACAACAABAACBACBACABABAAACCCBBBCACCBCCBCBAACBABBBBBCBBB
ABACCABCBBCAABCAABCBAAAACBBBBACAACAACCBAACAAABCCCBAAAABBCCBCCCAABAAAAAACBCBCACBCCB
CBCACBACCBBACBABAAACBCCAACAAABCAACABCBCAAABBCCCCBAAABACBCCBBBACBAACCBABAAABCBABCAC
BCCBCACABAABBCBABBBABBCBBABBCAABCCBCBABBCAACBBBBCBCCBCABCAAAACBCBBBBAAAAABACCAAAAB
CAACCBABAACABCCCABCBCABBBCAABBCBBABBABACCABCBBCACBCABCBABABCACACABACBAACABCBAABBAB
CBCCCCBBCACBCBACBBACABCCABCABABBACCCCACBABAABCBCACBABBCBABACBABBBABCCBCACACAABCAAA
BCABBCCBABCCBBACCABBAACCBAABAABCACBCACABBCCABCBABBCACCACCBBCCCABBABBCCABBCCCACABBC
ACBBACBAABBBCACCBBCBBCAACAACAABCBBCABBCCABCABBBACCBBABBBBBCABCAACBCCCCABBCCABACABB
CBCAACAABBBCACBAABCCCCCCBBBCCBBABABBBBBCAAABACACABCBBCCCCABABCCCBBABBABBABCAAABABB
CBBACAACACCBABCABABCCCAACCCBBAACCAABBBBBCAABBAAABBBBBCAACAACACCCACCCCCBBACBCABACAB
BBAAABACCBABCBCCCABABCACACAAAABBBCAAABCCABBAACACBCABACCAACCBCABBAAACAAABCBAAABABBC
BCABCBBBBAACCCCCCBACACBACCBBAACABBCABBACABCCAABACBAACABBBBCCBBAACBBBCAABAAABAACAAB
BBAACBAABCAAACBACBBCACBCACABAABABBBABBCBAACBBBBCBAAACBAAABACAABCCAABCCCCCCAAAAACBC
BBBBCAAACBBABCACCBCACAAABCACBBCCBBABBBACBACAACAAAABBCBACBCBACBBBBCACAABBBBAABAAAAC
CCBAACABBCBCCCCCACAAAABCAABABABCCBABAAABABAAABCACBCCBCBBCBBACBCBAACBBCABCBCCBBBBAB
AABBCAABABABAABCBCCAAABACCBCBACBCACABBBABBABCBCBBBAAAAABACAACABCCBAABCAACAACACABCC
BBBBBBAACBCACBCCAACBBBACBBCAAAAAAAAACAACBBACAABBAABBBBABABCCACBABCAAACACCBCCBBCABA
AACCABACACBACCCAABCBCBACCCABBACBCCABCAAABAABCBAABABCCABCABCCCCBCBACABAACABBBAACBBA
ACAAABCBCCABCACACBABBABAAACCAAABCBCCBBBCCBBCABABBCCACBCABBBCCCCAABABBAAAABBCCBCAAA
BCACACACABACACACAACCBAACBBAACACBACBCAACACCBCABBAABCACABABBCACAABBCBCBBACBABAABBBBC
BBCBACACBCABABBCBBCAACCAABCCBCBACBCAABCBCCAACCBAABCABABACACBBCCCBBABCBAAABABABBBCA
BBABCCACAABCCABCBABCBACCCCCACAAABBBCCBBBCCAAABABBAABCBCAABBACBCCCCBBBACCABBCBBCBCC
ACCBBBBCAAABACACBABACCAAABCACCCCABABACCACBBCBBBBBCBBCACABACBBBCCCBCBABCCCCCCCBACAB
BCCAABABAACCBBCBCAAAAAACCCACCCBACABACCACACBCBBCBACABCBCCACCBBBCBAACAACABACCCAACCCC
BCBCBCACAACBCCBCCCBACCABBBBCCBACBBBAABACBBAAABCCBBBAAACACAABBBCCABABCACABCCBBBCCBB
ACBACCBBACABBBBBAABABBCBAACAACCAABCAACCBBCCABCCBBABCABCBACCCACBBCCAAAABBCABCAABBAA
CACABBABCCCABBBCBCBBACCBAACACCBBCBACBBCCBBBBABABABCACBCBABBBAAABCBBACABBBBAABABCAC
BAAACCAAACBAAABBCABCACABABBBCCBACBCCBCBBABCAACACBBBABAACBABABBBAACBABCABCCABBABCBC
ABCACCCABCCCAABCAACCCBABBBCCBCABCABBABCCACCCCBABABCCCBBBCBAACAABABBBCAACACABABBBBA
CBBBAACCBAACCBAACBAAABBAABACBAAABCBBCABBABCAACCCCBABBCAABCCCAAACABAAABBCCBCCCCAAAC
BBCAABCBCBCBACBBAABBCBBAACABBCCCBCABBACBACAACCABAABBBBCCAABBABAACCACCAACABBABBAABA
ACBCCCCBACBCCBABCBAACBABBAABBACACBAACCBBBBBAAAAAACBCBAACCACBABAABBBAABCACBBAACACAB
ACACBBCCCCAAAABBBCCAAABAACABCBAACCBBACABAAACCABCBABACAAAABCBACAACCAABBACBABCCABCCC
AABCBAAABCABCCCBCBACBCAABCACBCCCBAACBABAABBABCACAAAAAAACACCCACBBCCAACACCBBABCAAACB
CACCABACCBCAACACBCACBCCAAAACAAABCCCCBBABBCCBBAAABABCACBBBCACBABCBABBBACAACCCBCBABA
BABCBCCBCCCBBBACAACBCAAAAACBBACCBCABBBBCBAACCCAACCCACABBBBABCBCBBCCABABAABAAACBAAB
CCBCCCCBBAAABBBBCACCAAACBCCBBAAABBBAAAACCBCBABCBACCCBCBAACBACBABBACBAACCABABBCBBBC
BBBACBCBBCCCCABCCABBABABCBBBCCCCBCCABBCBAABABCCCBBCACCCCBBAAABCBABABBABBACBABACBAB
CABCBCBCBABABCBAABBCCBACCBACACABACABBBCBBBABCCCACCAAABACABABBCBAABBCACCCCCCBACBABB
CBCBACBABCCAACBBBCCABBCBCCBCAAAABACABBBCBCBABBCBCACBCCABAACBBCCBABCAACACCACBBCACCB
BABCCCACBCBACCAACBABBBCCCCCBBAACBCCCABCBBBBBCBBBBBBACCAAAAAAACAAAABCBCABABBACCCCAA
BBCCABBBBBBCBBBABABBBBBBABCAACCCBCCABCCCAAACCCBAACBCCCACCACBABCBBAABAAABACCCBCABAC
BBACABCAAAACCACBCACCAAABBCBACBBBBABBABCBCBBABBBCBAACBACCCBCCCBBABACAACABAACAACACCA
CBCACAAABCBCACAABBBCCBAAAABAAABACBCCCAABCCCBABCBACCCAAABBACBACBACCABBCABAABACAABAA
ABACABBBABBACACCBBBCACCBCAAACBACAACCBBCAACAACBBBCBCAAABBACAACCBCABABCBBAABBBCBBCBA
BAAABBACACBCAAACBAAACABBCCBBAACBACACBBCBCBCBAABCACCCBCCBABABACCAABACCBCBCCCAABBABC
CCBCAAABCCACAACBCACCCBACAABACBCABACBCCACAAACACCCACCCAABBCACACBCACCBACCBBAABCBBCCBA
BACBBACACCABAAACACBCACAABAAACCABBBCABACCAAAABAACCBBBBCABABCCACCAAACBCBAABAACCBCBBB
CACBBABCBBCBAACBCCCCBBBBBBBBBCACABBBCBACCAAACCABCBCAACBCCACBBACCAAACBCACAABABCBCAA
BCBAACACACBACCBAABAAACCABAACAACBCCCCBCCCACBAABBBAAABABCAAACAABCABACCBBACAACCCBCABB
ABCCCCBAAAAACBCAAAABAACBCABBCACBCCCACAACACCCABBABAACACAABBABBBBACBCBBABAACBCCACACA
BCACACAACAACCCCBACACBACAABCACCCCBBBCABCACCAACCCABBBCABCCBCBBABBABCCACBBBBCABCABABC
BBACACBCCACACBBAABACBABBABAAABBCAACABCCCAAACBCAACBBCCABABBBAAABBABBAABAABCBBCBAAAA
CCACCBBCACBAABCBBBAAAAABABCABCCCABBABCACBCCCBAABBABBBACBACBCCABACCABBCBCBAABBBCAAB
ABABCAABBBABBAAACCBABBABBBCBBBABABAACCBCAAAAABABABABBCABBABCCCAACBBAAABCBACBCAAAAC
ACCCBAABABAACBABABBACCBBACCCBCCCACABCCBABCBBBCCBABABBBBBBBAACCBABCBABCBAAACBCBBABC
CCAAABCCBACCBAABABCACBAAAAAABAAAACBACAABAACCBCBCBAABAABBABACCABBCCBCAABBAACCAAABBA
BCACCABBBCAAACACAACABABAABBCABCABAAABCAAAACCACBBAABCACBCCBBCBBCCAACCCCACABCACCBCAA
BBBABCABAACAAABCBCBCACABAACACACBCACAAACACCBBCBBAACBACBBBBACBBCACCCCCBBABACBBBCAAAA

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.