10849 - Move the bishop

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

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

Post by algoJo »

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:

Post by mf »

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

Post by algoJo »

Thanks for replying mf.. :D
Got accepted :)
mohsincsedu
Learning poster
Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka
Contact:

Post by mohsincsedu »

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

Post by helloneo »

Well.. there is one more case.. think about it.. :-)
Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm
Location: Dhaka,Bangladesh.

Re: 10849 -WA!!!

Post by Prianka »

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

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

Post by maruf »

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....... :roll:
lives for eternity......
Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm
Location: Dhaka,Bangladesh.

Re: 10849 - Move the bishop

Post by Prianka »

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

Post by maruf »

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..... :roll:
lives for eternity......
Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm
Location: Dhaka,Bangladesh.

Re: 10849 - Move the bishop

Post by Prianka »

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

Post by maruf »

check this input && output :roll:
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
Location: Dhaka,Bangladesh.

Re: 10849 - Move the bishop

Post by Prianka »

Hello maruf,
I check ur input.All is matched with me without the last one.
It shows 2.
But your output is'no move',
But why?
it should be 2, is not it?
Here is my code?
please help.I am fade up with is problem,
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

Post by maruf »

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
Location: Dhaka,Bangladesh.

Re: 10849 - Move the bishop

Post by Prianka »

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

Please help!!!!!!!r valo lage na.

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

Post by maruf »

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

Return to “Volume 108 (10800-10899)”