## 10813 - Traditional BINGO

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

Moderator: Board moderators

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:

### 10813 - Traditional BINGO

I got WA with my code. Any one please send me some critical input and output.

lord_burgos
New poster
Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico
Contact:

### Re: WA ACM 10813

ibrahim wrote:I got WA with my code. Any one please send me some critical input and output.
your pronpon some , and we say to you

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:

### Re: WA ACM 10813

lord_burgos wrote:
ibrahim wrote:I got WA with my code. Any one please send me some critical input and output.
your pronpon some , and we say to you
I don't understand, what you say lord_burgos.

cytmike
Learning poster
Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States
Contact:
2
15 6
14 5

Both of them should be impossible.
Impossible is Nothing.

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

### About 10813

Hi ibrahim,

I think there is no critical input. The problem is very easy. I got wa at the contest time for some silly mistake, so u can check ur code for the array bound. I did..

1. At first i take all card.
2. Then take one after one upto 75 bingo numbers, if the bingo number is match with the card number then make it false.
3. If there are 5 card number is false in any direction then stop to take bingo number and output the recent bingo number.
4. There are 4 direction. (1). Horizontal (2). Vertical (3). Diagonal 1 (4). Diagonal 2

Hope it helps. Good luck.
Some Love Stories Live Forever ....

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:
Thanks Raj Ariyan. I got accept. I forget to check D2.

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan
And this case?

1
1 2 3 4 5
6 7 8 9 10
11 12 13 14
15 16 17 18 19
30 31 32 33 34
11 12 13 14 1 2 3 4 5 6 7 8 9 10
15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75

The output is?

The problem says "A player may mark the centre FREE SPACE at any time", so I can't mark a number in the card and the "free space" at one time, right?

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong
Hi htl, you can always mark the free space at the beginning of the game, before any number is called
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan
I still don't know why. It's too easy for me to get ac.

Please help me check the in/output

2
1 2 3 4 5
6 7 8 9 10
11 12 13 14
15 16 17 18 19
30 31 32 33 34
11 12 13 14 1 2 3 4 5 6 7 8 9 10
15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75
10 17 39 49 64
12 21 36 55 62
14 25 52 70
7 19 32 56 68
5 24 34 54 71
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75

BINGO after 4 numbers announced
BINGO after 14 numbers announced

And some critical cases?

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:
Hi htl!!! Your output is same as my AC code output.

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan
Maybe this is my last approach...post my code

Everybody can run it with your own cases

Maybe you will find out the bug

Code: Select all

``````#include<stdio.h>
#define YES 1
#define NO 0
void main(void)
{
int n,x,card[5][5],y,z,vertical[5],horizontal[5],diagonal[2],i,check[75],pos[75][2],found;
scanf("%d",&n);
for(x=0;x<n;x++)
{
for(y=0;y<75;y++)
check[y]=NO;
for(y=0;y<5;y++)
{
if(y==2)
{
scanf("%d %d %d %d",&card[y][0],&card[y][1],&card[y][3],&card[y][4]);
check[card[y][0]-1]=check[card[y][1]-1]=check[card[y][3]-1]=check[card[y][4]-1]=YES;
pos[card[y][0]-1][0]=2,pos[card[y][0]-1][1]=0,pos[card[y][1]-1][0]=2,pos[card[y][1]-1][1]=1,pos[card[y][3]-1][0]=2,pos[card[y][3]-1][1]=3,pos[card[y][4]-1][0]=2,pos[card[y][4]-1][1]=4;
}
else
for(z=0;z<5;z++)
scanf("%d",&card[y][z]),check[card[y][z]-1]=YES,pos[card[y][z]-1][0]=y,pos[card[y][z]-1][1]=z;
vertical[y]=horizontal[y]=0;
}
diagonal[0]=diagonal[1]=0;
for(y=0,found=NO;y<75;y++)
{
scanf("%d",&i);
if(check[i-1] && !found)
{
vertical[pos[i-1][1]]++,horizontal[pos[i-1][0]]++;
if(pos[i-1][0]==pos[i-1][1])
diagonal[0]++;
if(pos[i-1][0]+pos[i-1][1]==4)
diagonal[1]++;
if((vertical[2]==4 || horizontal[2]==4) || pos[i-1][0]!=2 && pos[i-1][1]!=2 && (vertical[pos[i-1][1]]==5 || horizontal[pos[i-1][0]]==5))
found=y+1;
if(diagonal[0]==4 || diagonal[1]==4)
found=y+1;
}
}
printf("BINGO after %d numbers announced\n",found);
}
}
``````
I think the reading part is ok, maybe the problem is in the checking part

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:
Hello htl,

One doubt - your input set number 1
1 2 3 4 5
6 7 8 9 10
11 12 13 14
15 16 17 18 19
30 31 32 33 34

clashes with input description

# Each space in the 'B' column contains a number from 1 - 15.
# Each space in the 'I' column contains a number from 16 - 30.
# Each space in the 'N' column contains a number from 31 - 45.
# Each space in the 'G' column contains a number from 46 - 60.
# Each space in the 'O' column contains a number from 61 - 75.

Any comments?

Regards,
Suman.

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan
You're right. I made a mistake in the input. But I assume that all the input are correct. Maybe there are some bugs in my program.

rubendv
New poster
Posts: 9
Joined: Mon Mar 15, 2004 10:23 pm

### 10813 - Doubt in the interpretation

Hi, I don't quite understand what is meant by "A player may mark the centre FREE SPACE at any time"! I interpreted this as:

At any time, a player may choose a valid number for column "N", (31 to 45) to assign to the free space.

This allows me to choose any number for 31 to 45 that does not appear in the column "N".
Given this assignment when the number appear, the position will be marked, or if it already has appeared it will be marked too.

I implemented my solution based on this supposition but I got Wrong Answer.

Can anyone tell me if my interpretation is right, please?

Thanks in advance.

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:
No, it means it's free - it's already "filled". Thus, you can win on the 4th turn.