In the SPOJ , for the given test case, output should be 4 right?
The problem is to find the maximum number of overlapping intervals right?
If you look at the example it should be 4 rigth?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
Please reply ...what changes?
On Thursday, January 24, 2013 1:35:38 PM UTC+5:30, emmy wrote:
please help me with the following problem:
http://www.spoj.com/problems/JUICE/
bit mask will require very large memory.
If I sort the intervals in decreasing order of their start time.. I still
in the sorted array, if suppose fr[i].start==fr[i+1].start then u only
consider a cut at f[i+1] (that means ith fruit is also cut with the (i+1)th
fruit.
Thus u keep on incrementing the sorted array until u find sm j s.t.
f[j].start!=f[j+1].start
Then u check for the condition :
How do i check that condition??? should I include
if(f[j].first==f[i].second)match++ ??
On Thursday, January 24, 2013 1:35:38 PM UTC+5:30, emmy wrote:
please help me with the following problem:
http://www.spoj.com/problems/JUICE/
bit mask will require very large memory.
If I sort the
@ all.
what if we use greedy approch..like if we slice when in remaining fruits on
screen any one fruit is going to disappear?will it work?
On Friday, February 1, 2013 9:07:14 AM UTC+5:30, emmy wrote:
Ohk.. I finally got it.
Thanks guys!!
This was great help.
On Mon, Jan 28, 2013 at
? ^^
On Thursday, January 24, 2013 1:35:38 PM UTC+5:30, emmy wrote:
please help me with the following problem:
http://www.spoj.com/problems/JUICE/
bit mask will require very large memory.
If I sort the intervals in decreasing order of their start time.. I still
cant make it to a
did u see the comment that nikhil made
herehttp://stackoverflow.com/questions/14545917/spoj-juice-extractor-wrong-ans
?
On Thu, Feb 21, 2013 at 1:00 AM, marti amritsa...@gmail.com wrote:
? ^^
On Thursday, January 24, 2013 1:35:38 PM UTC+5:30, emmy wrote:
please help me with the
Need help
Here is my code:
http://shrib.com/fruit
On Thursday, January 24, 2013 1:35:38 PM UTC+5:30, emmy wrote:
please help me with the following problem:
http://www.spoj.com/problems/JUICE/
bit mask will require very large memory.
If I sort the intervals in decreasing order of their start
Ohk.. I finally got it.
Thanks guys!!
This was great help.
On Mon, Jan 28, 2013 at 4:11 PM, Nikhil Karnwal sunnyk12...@gmail.comwrote:
no ...when u figure out those m matches just sort them ..now let k=[0,m]
if currently u are assuming that kth match is already sliced then all
before that k
no ...when u figure out those m matches just sort them ..now let k=[0,m]
if currently u are assuming that kth match is already sliced then all
before that k matches are already sliced.and this u can do by moving
incrementally from 0 to mth matches.
On Mon, Jan 28, 2013 at 1:43 PM, foram lakhani
by match u mean that number of fruits that overlap with i th fruit but are
not sliced before time i.
which means we have to consider 2^m cases where m is the maximum number of
fruits that overlap with ith fruit.
And this we have to do for each fruit.
On Mon, Jan 28, 2013 at 12:54 AM, Nikhil
NO its not 2^m ,,, you have to use sorting technique .generally we t
do such sorting thing in time interval scheduling(standard greedy
problem).in case you didn,t understand let me know ...
On Monday, January 28, 2013 1:43:35 PM UTC+5:30, emmy wrote:
by match u mean that number of
Actually dp[i] represent the state in which u make a slice at appearing
time of i th fruits.and match represent the overlapping fruits
with i.
so
for each i dp[i]=max(dp[i],dp[j]+match);
for all j=[0,i] and match =overlapped fruits with i which are not sliced
until the cut of j.
Hope this will
take a structure or pair of start time and finish time and then sort the
the structure you know the comparator function the for each for each dp[i]
select j belongs to (0,i) and then count the overlap value
if(j==0)
dp[i]=max(dp[i],match);
else
Thanx for the reply but I didnt get you. What does dp[i] represent ?
On Thu, Jan 24, 2013 at 9:50 PM, sunny sharadsin...@gmail.com wrote:
take a structure or pair of start time and finish time and then sort the
the structure you know the comparator function the for each for each dp[i]
select
15 matches
Mail list logo