12337 - Bob's Beautiful Balls

All about problems in Volume 123. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
cutenemo
New poster
Posts: 7
Joined: Fri Dec 13, 2013 9:52 pm
Location: California

12337 - Bob's Beautiful Balls

Post by cutenemo » Fri Jan 31, 2014 11:41 pm

I keep getting WA for this problem. I'm transforming the string into a matrix (spiral) and then comparing checking if each column has only one color.

I tried these cases myself
Sample Input
7
BGWBBGGGBBWGBBGWBB
GBBWBBWBBB
BBBBBBBBBBBBBBB
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWW
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GGGGGGGGGGGG
BGWBBGGGBBWGBBGWBBB
BBBBWWBBBB
Output for Sample Input
Case 1: 9
Case 2: -1
Case 3: 8
Case 4: -1
Case 5: 20
Case 6: 7
Case 7: -1
Case 8: 7
Can anyone help with more test cases that I can check?

Thank you

mjimaz
New poster
Posts: 6
Joined: Thu Jan 09, 2014 1:03 am

Re: 12337 - Bob's Beautiful Balls

Post by mjimaz » Sun Feb 02, 2014 3:11 am

Your input testcases should be 8, I'm guessing that's a typo.

Try these:

Input:

4
BBBB
BB
BGGB
WWBWW

Output:

Case 1: 4
Case 2: -1
Case 3: 4
Case 4: -1

Keep in mind, If there is more than one N & M solution, the lowest sum is the answer.
Also if N = 6 and M = 3 does give you -1, maybe N = 3 and M = 6 works. So try the 2nd if the first doesn't give a beautiful grid.

Thanks for the cases, helped me a lot ;D

cutenemo
New poster
Posts: 7
Joined: Fri Dec 13, 2013 9:52 pm
Location: California

Re: 12337 - Bob's Beautiful Balls

Post by cutenemo » Sun Feb 02, 2014 3:17 am

I get the same answers!!!!! :evil: :evil: :evil:

Thanks though

mjimaz
New poster
Posts: 6
Joined: Thu Jan 09, 2014 1:03 am

Re: 12337 - Bob's Beautiful Balls

Post by mjimaz » Sun Feb 02, 2014 3:58 am

Try this:

Input:

1
GGGGGGGGGGGGGGGGGGGGGGGG

Output:

Case 1: 10

cutenemo
New poster
Posts: 7
Joined: Fri Dec 13, 2013 9:52 pm
Location: California

Re: 12337 - Bob's Beautiful Balls

Post by cutenemo » Sun Feb 02, 2014 6:22 am

Solved it finally!!

I was failing on this case!

BGWWWWWGBBBBGGG
Answer = 8

Post Reply

Return to “Volume 123 (12300-12399)”