Page 1 of 2

10813 - Traditional BINGO

Posted: Wed Feb 16, 2005 5:01 am
by ibrahim
I got WA with my code. Any one please send me some critical input and output.

Re: WA ACM 10813

Posted: Wed Feb 16, 2005 6:40 am
by lord_burgos
ibrahim wrote:I got WA with my code. Any one please send me some critical input and output.
your pronpon some :P , and we say to you

Re: WA ACM 10813

Posted: Wed Feb 16, 2005 1:33 pm
by ibrahim
lord_burgos wrote:
ibrahim wrote:I got WA with my code. Any one please send me some critical input and output.
your pronpon some :P , and we say to you
I don't understand, what you say lord_burgos.

Posted: Wed Feb 16, 2005 3:42 pm
by cytmike
2
15 6
14 5



Both of them should be impossible.

About 10813

Posted: Wed Feb 16, 2005 3:52 pm
by Raj Ariyan
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.

Posted: Wed Feb 16, 2005 5:59 pm
by ibrahim
Thanks Raj Ariyan. I got accept. I forget to check D2.

Posted: Thu Feb 17, 2005 3:40 am
by htl
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?

Posted: Thu Feb 17, 2005 5:11 am
by Observer
Hi htl, you can always mark the free space at the beginning of the game, before any number is called :wink:

Posted: Thu Feb 17, 2005 11:41 am
by htl
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?

Posted: Thu Feb 17, 2005 10:43 pm
by ibrahim
Hi htl!!! Your output is same as my AC code output.

Posted: Fri Feb 18, 2005 4:33 am
by htl
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

Posted: Mon Feb 21, 2005 10:46 am
by sumankar
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.

Posted: Mon Feb 21, 2005 2:51 pm
by htl
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.

10813 - Doubt in the interpretation

Posted: Tue Mar 01, 2005 12:48 am
by rubendv
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.

Posted: Tue Mar 01, 2005 12:59 am
by Larry
No, it means it's free - it's already "filled". Thus, you can win on the 4th turn.