http://www.spoj.pl/problems/THRBL/
my code is
i am getting TLE
# includeiostream
# includecstdio
using namespace std;
//int search(long long int [],long long )
int main()
{
while(1)
{
int n,m;
int count=0;
long long int a[50010]={0};
int b[50010],c[50010];
if((scanf(%d%d,n,m))==EOF)
break;
int
@Karthik : Can you please the logic ??. Would be nice ..
On Fri, Jun 10, 2011 at 12:42 PM, kartik sachan kartik.sac...@gmail.comwrote:
http://www.spoj.pl/problems/THRBL/
my code is
i am getting TLE
# includeiostream
# includecstdio
using namespace std;
//int search(long long int [],long
what i understand from the problem was that.
n no of higests are given
and a and b and city no i.e from city a a ball is thrown to city no b
so i have done
from array a[] i.e hieght { n...no of times}
find all the element between b[i].city A and
i agree with the logici also implemented it...and getting TLE...there
must exist some better method :(
On Fri, Jun 10, 2011 at 2:18 AM, kartik sachan kartik.sac...@gmail.comwrote:
what i understand from the problem was that.
n no of higests are given
and a and b and city no
how should we get TLE loop total running less than 10^6??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
Use Range Maximum Query.
On Fri, Jun 10, 2011 at 4:15 PM, kartik sachan kartik.sac...@gmail.comwrote:
how should we get TLE loop total running less than 10^6??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
u construct a tree nlogn , every node answers a query.. (or u get ans with a
recursion) in log(n) , so when u r doing a lot of query RMQ proves to be
very fast
On Fri, Jun 10, 2011 at 6:28 PM, nicks crazy.logic.k...@gmail.com wrote:
ya i saw that in the comments on spoj someone suggested to use
Suppose you are given an array a[]={2,3,1,4,6,7,10}
now for successfully transferring the ball,from ith city to jth city,a[i]
max(a[i..j-1]).
A naive approach would be to calculate all possible max[i][j] that is max
for each interval and then answer the query in 0(1) time.Another approach
would