Saturday, January 27, 2018

UVa problem soultion 1112 - Mice and Maze

problem link:

Discuss: in this problem you can simply use dijksta and solve it.  jut loop through 1 to n and call dijkstra every time.if distant of exit node is less or equal then timer then make count increase. there is no tricky part in this problem.


try yourself , before see the code


Friday, January 26, 2018

UVa problem solution 10986 - Sending email

problem link:

Discuss: in this problem you can simply use dijksta algorithm.if you know the algorithm then this problem just direct implementation of that algroithm. there is no tricky part in this problem

try yourself, before see the code


UVa problem solution 10305 - Ordering Tasks

problem link:

Discuss: you can solve this problem using modified dfs or bfs. we call dfs for every adjacent vertices first.then push every vertex to stack. then just print stack.there is no tricky part in this problem.

try yourself, before see the code


Thursday, January 18, 2018

UVa problem solution 352 - The Seasonal War

problem link:


Discuss: in this problem you to have to find how many disjoint eagle is there.so you can simply use dfs or bfs to solve this problem.when you get a eagle sign and not visited increment count and send it to bfs or dfs function. it will make visited all joint eagle.

try yourself, before see the code


Tuesday, January 16, 2018

UVa problem solution 871 - Counting Cells in a Blob

problem link:

Discuss:this is simple graph problem.you can use bfs to solve.just count how much node visited in a call of bfs function and store it in maximum.you can use getline to take input.and push it to your 2d string and if string is empty just break input.there is no tricky part in this problem

try yourself,before see the code


UVa problem solution 572 - Oil Deposits

problem link:

Discuss: this is simple graph. if you know the fundamental algorithm of graph i mean bfs or dfs then it's pretty easy for you. when you found a node with '@' and it is not visited then just sent the index value to bfs function and increment the answer and in bfs function mark every connected node with it visited. your work done.


try yourself before see the code


Sunday, January 14, 2018

UVa problem solution 10004 - Bicoloring

problem link:

Discuss: if you know bfs algorithm then this problem is fun for you. just do bfs nothing more to do.just first take a color array as like visiting array. convert all number to zero.then in while loop if the color is zero and adjacent node color is then assign it with 2 else 1. and if two adjacent node color same then just break the loop.

try yourself before see the code