10102 - The path in the colored field

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

Moderator: Board moderators

zobayer
Experienced poster
Posts: 110
Joined: Tue May 06, 2008 2:18 pm
Location: CSE-DU, Bangladesh
Contact:

Re: 10102 - The Path in the Colored Field

Post by zobayer »

There is no extra space in input file.

Code: Select all

for(i = 0; i < n; i++) scanf("%s", grid[i]);
This is enough to read input.
You should not always say what you know, but you should always know what you say.

outsbook
New poster
Posts: 26
Joined: Fri Oct 28, 2011 2:42 am

10102 - The path in the colored field

Post by outsbook »

BFS problem

Maximum length of M=100
For each location(x,y) you got four adjacency location 1.(x-1,y) 2.(x+1,y) 3.(x,y-1) 4.(x,y+1)
When taking in the input, keep a list of all 1-nodes and all 3-nodes.
For each 1-node, find the distance to the closest 3-node.
distance=abs(1.x - 3.x) + abs(1.y - 3.y).
Output the greatest distance amongst all 1-nodes.
"Learning to love yourself is the greatest love of all" - Michael Masser and Linda Creed

Reham
New poster
Posts: 1
Joined: Tue Jul 17, 2012 2:43 pm

Re: 10102 - The Path in the Colored Field

Post by Reham »

i need additional test cases to make sure i understand the problem well
thanks in advance

dhruba07
New poster
Posts: 20
Joined: Tue May 21, 2013 9:02 pm
Location: BUET

Re: 10102 - The Path in the Colored Field

Post by dhruba07 »

I am getting wrong answer.I can't understand what is wrong with my code :oops:

Code: Select all

Thanks brianfry. Got AC
Last edited by dhruba07 on Thu Dec 05, 2013 1:00 am, edited 1 time in total.
Accept who you are :)

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10102 - The Path in the Colored Field

Post by brianfry713 »

Insert minimum=99999; before line 99.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 101 (10100-10199)”