758 - The Same Game

All about problems in Volume 7. 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
obayashi
New poster
Posts: 33
Joined: Thu Jun 20, 2002 1:18 pm

758 - The Same Game

Post by obayashi »

I kept gettin' WA with problem 758.
Can any one gimme some special test case???
Time makes a fool of memory
And yet my memories still shine
zsacul
New poster
Posts: 7
Joined: Sat Aug 17, 2002 8:11 pm
Location: Poland

Post by zsacul »

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...
obayashi
New poster
Posts: 33
Joined: Thu Jun 20, 2002 1:18 pm

Post by obayashi »

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.
Time makes a fool of memory
And yet my memories still shine
roy
New poster
Posts: 4
Joined: Sun Jul 30, 2006 7:02 am

758 Asking for test case

Post by roy »

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
roy
New poster
Posts: 4
Joined: Sun Jul 30, 2006 7:02 am

Post by roy »

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
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG

RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR
RRRRRRRRRRRRRRR

RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBRRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG

RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG
RRRRRRRRRRRRRRG

BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGYYYYYGRBGR
GRBGRYGRBYRBGRB
BYYYYYYYYYYYYYY
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG

RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRYYRBGRBGRBG
BGRBGRBGRBGRBGR
GRBGRBGRBGRBGRB
RBGRBGRBGRBGRBG







Game 1:

Move 1 at (4,1): removed 32 balls of color B, got 900 points.
Move 2 at (2,1): removed 39 balls of color R, got 1369 points.
Move 3 at (1,1): removed 37 balls of color G, 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.
mmh.riyad
New poster
Posts: 4
Joined: Thu Dec 18, 2014 10:10 am

Re: 758 - The Same Game

Post by mmh.riyad »

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.
mmh.riyad
New poster
Posts: 4
Joined: Thu Dec 18, 2014 10:10 am

Re: 758 - The Same Game

Post by mmh.riyad »

zsacul 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...
Cant understand these! :S
What will the input and output for this case?
mmh.riyad
New poster
Posts: 4
Joined: Thu Dec 18, 2014 10:10 am

Re: 758 - The Same Game

Post by mmh.riyad »

Got AC :D :D :D :D :D :D :D :D :D :lol: :lol: :lol: :lol: :lol: :lol: :lol:

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
Output:

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.
Post Reply

Return to “Volume 7 (700-799)”