### 758 - The Same Game

Posted:

**Fri Aug 09, 2002 2:42 pm**I kept gettin' WA with problem 758.

Can any one gimme some special test case???

Can any one gimme some special test case???

Page **1** of **1**

Posted: **Fri Aug 09, 2002 2:42 pm**

I kept gettin' WA with problem 758.

Can any one gimme some special test case???

Can any one gimme some special test case???

Posted: **Sat Aug 17, 2002 8:27 pm**

There is a strange multiple input in this problem, try to add

[cpp]scanf("%d\n",&nf);[/cpp]

at the begining and

use loop

[cpp]while (scanf("%d\n",&nGames)!=EOF)[/cpp]

after that...

[cpp]scanf("%d\n",&nf);[/cpp]

at the begining and

use loop

[cpp]while (scanf("%d\n",&nGames)!=EOF)[/cpp]

after that...

Posted: **Sun Aug 18, 2002 4:08 am**

i know that, but thank you all the same.

this problem is collected out from ICPC 1999 NW Pacific Region, and i think it worth doing, but i kept wrong answer with it...

i wanna know if there is a standard and common simple solution for such "same game" problems.

this problem is collected out from ICPC 1999 NW Pacific Region, and i think it worth doing, but i kept wrong answer with it...

i wanna know if there is a standard and common simple solution for such "same game" problems.

Posted: **Tue Aug 01, 2006 6:36 pm**

i think my program should work correctly however i get WA from the judge. I think my program should have some bugs but i can't find it out. Can anyone post test cases and the correct results to help me. Thx

Posted: **Thu Aug 03, 2006 9:05 am**

i have got AC in this question. Here is my input and output files. Hope they can help you.

Code: Select all

```
8
RGGBBGGRBRRGGBG
RBGRBGRBGRBGRBG
RRRRGBBBRGGRBBB
GGRGBGGBRRGGGBG
GBGGRRRRRBGGRRR
BBBBBBBBBBBBBBB
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
RRRRRRGGGGRRRRR
GGGGGGGGGGGGGGG
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
GGGGGGGGGGGGGGG
GGGGGGGGGGGGGGG
BBBBBBBBBBBBBBB
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
GGGGGGGGGGGGGGG
GGGGGGGGGGGGGGG
RBGRBGRBGRBGRBG
BGRBGRB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got 1225 points.
Move 4 at (3,4): removed 11 balls of color B, got 81 points.
Move 5 at (1,1): removed 8 balls of color R, got 36 points.
Move 6 at (2,1): removed 6 balls of color G, got 16 points.
Move 7 at (1,6): removed 6 balls of color B, got 16 points.
Move 8 at (1,2): removed 5 balls of color R, got 9 points.
Move 9 at (1,2): removed 5 balls of color G, got 9 points.
Final score: 3661, with 1 balls remaining.
Game 2:
Move 1 at (1,1): removed 30 balls of color G, got 784 points.
Move 2 at (1,1): removed 30 balls of color R, got 784 points.
Move 3 at (1,1): removed 30 balls of color B, got 784 points.
Move 4 at (1,1): removed 30 balls of color G, got 784 points.
Move 5 at (1,1): removed 30 balls of color R, got 784 points.
Final score: 4920, with 0 balls remaining.
Game 3:
Final score: 0, with 150 balls remaining.
Game 4:
Move 1 at (1,1): removed 150 balls of color R, got 21904 points.
Final score: 22904, with 0 balls remaining.
Game 5:
Move 1 at (4,4): removed 3 balls of color R, got 1 points.
Move 2 at (3,4): removed 3 balls of color B, got 1 points.
Move 3 at (4,3): removed 5 balls of color G, got 9 points.
Move 4 at (4,2): removed 3 balls of color B, got 1 points.
Move 5 at (4,1): removed 7 balls of color R, got 25 points.
Move 6 at (4,1): removed 4 balls of color G, got 4 points.
Move 7 at (3,1): removed 5 balls of color B, got 9 points.
Move 8 at (3,1): removed 4 balls of color R, got 4 points.
Move 9 at (2,1): removed 6 balls of color G, got 16 points.
Move 10 at (2,1): removed 3 balls of color B, got 1 points.
Move 11 at (1,1): removed 3 balls of color R, got 1 points.
Final score: 72, with 104 balls remaining.
Game 6:
Move 1 at (1,1): removed 140 balls of color R, got 19044 points.
Move 2 at (1,1): removed 10 balls of color G, got 64 points.
Final score: 20108, with 0 balls remaining.
Game 7:
Move 1 at (5,2): removed 21 balls of color Y, got 361 points.
Move 2 at (4,6): removed 3 balls of color G, got 1 points.
Move 3 at (5,5): removed 5 balls of color R, got 9 points.
Move 4 at (5,7): removed 4 balls of color B, got 4 points.
Move 5 at (5,8): removed 3 balls of color G, got 1 points.
Move 6 at (5,9): removed 4 balls of color R, got 4 points.
Move 7 at (6,1): removed 2 balls of color G, got 0 points.
Move 8 at (5,1): removed 3 balls of color B, got 1 points.
Move 9 at (4,1): removed 5 balls of color R, got 9 points.
Move 10 at (5,4): removed 2 balls of color G, got 0 points.
Move 11 at (5,3): removed 5 balls of color B, got 9 points.
Move 12 at (5,2): removed 3 balls of color G, got 1 points.
Move 13 at (5,3): removed 4 balls of color R, got 4 points.
Move 14 at (4,4): removed 3 balls of color G, got 1 points.
Move 15 at (4,2): removed 4 balls of color B, got 4 points.
Final score: 409, with 79 balls remaining.
Game 8:
Move 1 at (4,5): removed 2 balls of color Y, got 0 points.
Move 2 at (4,4): removed 2 balls of color R, got 0 points.
Move 3 at (4,3): removed 4 balls of color G, got 4 points.
Move 4 at (4,2): removed 5 balls of color B, got 9 points.
Move 5 at (4,1): removed 8 balls of color R, got 36 points.
Move 6 at (4,1): removed 7 balls of color G, got 25 points.
Move 7 at (3,1): removed 11 balls of color B, got 81 points.
Move 8 at (3,1): removed 7 balls of color R, got 25 points.
Move 9 at (2,1): removed 8 balls of color G, got 36 points.
Move 10 at (2,1): removed 4 balls of color B, got 4 points.
Move 11 at (1,1): removed 6 balls of color R, got 16 points.
Move 12 at (1,1): removed 2 balls of color G, got 0 points.
Move 13 at (1,1): removed 2 balls of color B, got 0 points.
Move 14 at (1,2): removed 2 balls of color G, got 0 points.
Move 15 at (1,2): removed 2 balls of color B, got 0 points.
Move 16 at (1,1): removed 4 balls of color R, got 4 points.
Move 17 at (1,1): removed 4 balls of color G, got 4 points.
Move 18 at (1,1): removed 5 balls of color B, got 9 points.
Move 19 at (1,1): removed 5 balls of color R, got 9 points.
Move 20 at (1,1): removed 5 balls of color G, got 9 points.
Move 21 at (1,1): removed 5 balls of color B, got 9 points.
Move 22 at (1,1): removed 5 balls of color R, got 9 points.
Move 23 at (1,1): removed 5 balls of color G, got 9 points.
Move 24 at (1,1): removed 5 balls of color B, got 9 points.
Move 25 at (1,1): removed 5 balls of color R, got 9 points.
Move 26 at (1,1): removed 5 balls of color G, got 9 points.
Move 27 at (1,1): removed 5 balls of color B, got 9 points.
Move 28 at (1,1): removed 4 balls of color R, got 4 points.
Move 29 at (1,1): removed 4 balls of color G, got 4 points.
Move 30 at (1,1): removed 3 balls of color B, got 1 points.
Move 31 at (1,1): removed 3 balls of color R, got 1 points.
Move 32 at (1,1): removed 2 balls of color G, got 0 points.
Move 33 at (1,1): removed 2 balls of color B, got 0 points.
Final score: 344, with 2 balls remaining.
```

Posted: **Thu Sep 10, 2015 1:54 pm**

My program gives all correct output of this post. But still getting WA.

Cant understand where is the problem?

Can anybody provide some critical input-output? Thanks is advance.

Cant understand where is the problem?

Can anybody provide some critical input-output? Thanks is advance.

Posted: **Thu Sep 10, 2015 1:56 pm**

Cant understand these! :Szsacul wrote:There is a strange multiple input in this problem, try to add

[cpp]scanf("%d\n",&nf);[/cpp]

at the begining and

use loop

[cpp]while (scanf("%d\n",&nGames)!=EOF)[/cpp]

after that...

What will the input and output for this case?

Posted: **Fri Sep 11, 2015 6:57 am**

Got AC

Try this:

Input:
Output:

Try this:

Input:

Code: Select all

```
6
RRRRRRRRRRRGRRR
RGRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RGRRRRRRRRRGRRR
RRRRRRRRRRRRRRR
RRGRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRGRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
BBBBBBBBBBBBBBB
RRRRRRRRRRRRRRR
BBBBBBBBBBBBBBB
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBRBRBRBRBRBRBR
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
```

Code: Select all

```
Game 1:
Move 1 at (1,1): removed 144 balls of color R, got 20164 points.
Move 2 at (1,1): removed 6 balls of color G, got 16 points.
Final score: 21180, with 0 balls remaining.
Game 2:
Move 1 at (1,1): removed 140 balls of color R, got 19044 points.
Move 2 at (1,1): removed 10 balls of color G, got 64 points.
Final score: 20108, with 0 balls remaining.
Game 3:
Move 1 at (1,1): removed 150 balls of color R, got 21904 points.
Final score: 22904, with 0 balls remaining.
Game 4:
Move 1 at (1,1): removed 15 balls of color B, got 169 points.
Move 2 at (1,1): removed 15 balls of color R, got 169 points.
Move 3 at (1,1): removed 15 balls of color B, got 169 points.
Move 4 at (1,1): removed 15 balls of color R, got 169 points.
Move 5 at (1,1): removed 15 balls of color B, got 169 points.
Move 6 at (1,1): removed 15 balls of color R, got 169 points.
Move 7 at (1,1): removed 15 balls of color B, got 169 points.
Move 8 at (1,1): removed 15 balls of color R, got 169 points.
Move 9 at (1,1): removed 15 balls of color B, got 169 points.
Move 10 at (1,1): removed 15 balls of color R, got 169 points.
Final score: 2690, with 0 balls remaining.
Game 5:
Move 1 at (1,1): removed 10 balls of color R, got 64 points.
Move 2 at (1,1): removed 10 balls of color B, got 64 points.
Move 3 at (1,1): removed 10 balls of color R, got 64 points.
Move 4 at (1,1): removed 10 balls of color B, got 64 points.
Move 5 at (1,1): removed 10 balls of color R, got 64 points.
Move 6 at (1,1): removed 10 balls of color B, got 64 points.
Move 7 at (1,1): removed 10 balls of color R, got 64 points.
Move 8 at (1,1): removed 10 balls of color B, got 64 points.
Move 9 at (1,1): removed 10 balls of color R, got 64 points.
Move 10 at (1,1): removed 10 balls of color B, got 64 points.
Move 11 at (1,1): removed 10 balls of color R, got 64 points.
Move 12 at (1,1): removed 10 balls of color B, got 64 points.
Move 13 at (1,1): removed 10 balls of color R, got 64 points.
Move 14 at (1,1): removed 10 balls of color B, got 64 points.
Move 15 at (1,1): removed 10 balls of color R, got 64 points.
Final score: 1960, with 0 balls remaining.
Game 6:
Final score: 0, with 150 balls remaining.
```