May 28th, 2013, 02:21 PM
There is a river that runs horizontally through an area. There are a set of cities above and below the river. Each city above the river is matched with a city below the river, and you are given this matching as a set of pairs.
You are interested in building a set of bridges across the river to connect the largest number of the matching pairs of cities, but you must do so in a way that no two bridges intersect one another.
I am sorting the first set and then finding the largest increasing subsequence from second set despite trying all test cases. I am getting wrong answer. Please help if there is something wrong with the approach or any test case i am missing.
Here is the link to the original problem: http://www.spoj.com/problems/BRIDGE/
using namespace std;
inline int myf(dj dj1,dj dj2)
Tags for this Thread
Click Here to Expand Forum to Full Width