## 10849 - Move the bishop

Moderator: Board moderators

algoJo
New poster
Posts: 37
Joined: Sun Dec 17, 2006 9:02 am
it's strange...
is the i/o in problem description are right??
how came

INPUT

Code: Select all

``````1

1
8
7 2 1 4
``````
OUTPUT

Code: Select all

``````2
``````
can't figure out how...
and what are the output for
INPUT

Code: Select all

``````1

1
6
2 3 2 3
``````

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:
how came

INPUT

Code: Select all

``````1

1
8
7 2 1 4
``````
OUTPUT

Code: Select all

``````2
``````
Here's a picture of this sample case:

Code: Select all

``````  1 2 3 4 5 6 7 8
1 . . . c . . . .
2 . . . . \ . . .
3 . . . . . b . .
4 . . . . / . . .
5 . . . / . . . .
6 . . / . . . . .
7 . a . . . . . .
8 . . . . . . . .
``````
Bishop can move from (7,2) to (3,6), and then to (1,4). That's 2 moves.

algoJo
New poster
Posts: 37
Joined: Sun Dec 17, 2006 9:02 am
Got accepted

mohsincsedu
Learning poster
Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka
Contact:
I have a problem:

I can not find any output greater than 2.

my algo is:

1. x1,y1,x2,y2 <------- take input
2. if x1+y1 and x2+y2 both odd or even
a) if x1+y1 and x2+y2 are equal
number of move is 1
b) else
number of move is 2
3. else
no move

am i right..
Amra korbo joy akhdin............................

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Well.. there is one more case.. think about it..

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 -WA!!!

Hello everybody, I am getting WA with this code. What is the bug?

Code: Select all

``cut``
I also try long long int.
thanks..
Last edited by Prianka on Sat Jul 05, 2008 6:47 pm, edited 1 time in total.
Nothing is impossible............

maruf
New poster
Posts: 17
Joined: Sat May 24, 2008 6:00 pm

### Re: 10849 - Move the bishop

check this input:
1 1 2 2
output of my acc code is:
1
hope it will help....there are more conditions than u have assumed.......
lives for eternity......

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 - Move the bishop

Hi, Maruf,
I add this condition but still getting WA!!!!!!!!!!

Code: Select all

``````else if(x1==y1 && x2==y2)
printf("1\n");``````
thanks.
Nothing is impossible............

maruf
New poster
Posts: 17
Joined: Sat May 24, 2008 6:00 pm

### Re: 10849 - Move the bishop

what will happen if the bishop or the target is placed out of the board??
you should consider the black and white cells of the chess board accurately.......
the bishop can be white and black colours too.....
lives for eternity......

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 - Move the bishop

give me some sample input output please........
Nothing is impossible............

maruf
New poster
Posts: 17
Joined: Sat May 24, 2008 6:00 pm

### Re: 10849 - Move the bishop

check this input && output
1 //test case
16 // the number of tests for that case.
5 //chess board with NxN squares

1 1 1 1
0
1 1 2 1
no move
1 1 1 2
no move
1 1 2 2
1
1 1 6 1
no move
1 1 1 3
2
1 1 3 1
2
2 1 3 1
no move
2 1 3 2
1
2 1 2 3
2
1 1 5 5
1
1 2 5 4
2
1 1 1 5
2
1 2 1 5
no move
2 2 2 2
0
6 3 1 4
no move
lives for eternity......

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 - Move the bishop

Hello maruf,
I check ur input.All is matched with me without the last one.
It shows 2.
But why?
it should be 2, is not it?
Here is my code?
thanks for help.........

Code: Select all

``````acc
``````
Last edited by Prianka on Sat Jul 05, 2008 11:06 pm, edited 1 time in total.
Nothing is impossible............

maruf
New poster
Posts: 17
Joined: Sat May 24, 2008 6:00 pm

### Re: 10849 - Move the bishop

cut
Last edited by maruf on Sun Jul 06, 2008 7:45 am, edited 1 time in total.
lives for eternity......

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 - Move the bishop

Still getting WA!!!!!!!!!!!!!
I change my code

Code: Select all

``acc``
Last edited by Prianka on Sat Jul 05, 2008 11:07 pm, edited 1 time in total.
Nothing is impossible............

maruf
New poster
Posts: 17
Joined: Sat May 24, 2008 6:00 pm

### Re: 10849 - Move the bishop

cut
Last edited by maruf on Sun Jul 06, 2008 7:45 am, edited 1 time in total.
lives for eternity......