Re: [algogeeks] Please explain this problem

2011-06-12 Thread keyan karthi
@saurabh: ya u checked tat... then ur logic seems rite.. On Sun, Jun 12, 2011 at 2:27 PM, nicks wrote: > @keyan...that solves my problem...got AC...thanks :) > > > On Sun, Jun 12, 2011 at 1:15 AM, nicks wrote: > >> forgot to attach the code...here is the modified code.. >> >> #include >> #includ

Re: [algogeeks] Please explain this problem

2011-06-12 Thread nicks
@keyan...that solves my problem...got AC...thanks :) On Sun, Jun 12, 2011 at 1:15 AM, nicks wrote: > forgot to attach the code...here is the modified code.. > > #include > #include > #include > #include > #include > > using namespace std; > > int main() > { > int num,ans=0,value,i,j,k,t,a,b,

Re: [algogeeks] Please explain this problem

2011-06-12 Thread saurabh singh
where I am I dividing by 0? i have used the check if(s[l]) p1[k++]=(s[i]+s[j])*s[l]; On Sun, Jun 12, 2011 at 1:58 PM, keyan karthi wrote: > @saurabh,nick: u cant divide by 0.. u need to check it while generating the > array.. > > i used somethin like this... > > >1. void fun(int n) >

Re: [algogeeks] Please explain this problem

2011-06-12 Thread keyan karthi
@saurabh,nick: u cant divide by 0.. u need to check it while generating the array.. i used somethin like this... 1. void fun(int n) 2. { 3. int a,b,cl; 4. for(a=0;a wrote: > I am trying really hard to get this one fixed,still cant find any > problem..:-( > > > On Sun, Jun 12, 20

Re: [algogeeks] Please explain this problem

2011-06-12 Thread saurabh singh
I am trying really hard to get this one fixed,still cant find any problem..:-( On Sun, Jun 12, 2011 at 1:45 PM, nicks wrote: > forgot to attach the code...here is the modified code.. > > #include > #include > #include > #include > #include > > using namespace std; > > int main() > { > in

Re: [algogeeks] Please explain this problem

2011-06-12 Thread nicks
forgot to attach the code...here is the modified code.. #include #include #include #include #include using namespace std; int main() { int num,ans=0,value,i,j,k,t,a,b,c,d,e,f; scanf("%d",&num); vector val,a1,a2; for(i=0;i::iterator itr; for(itr=a1.begin();itr!=a1.end();itr++)

Re: [algogeeks] Please explain this problem

2011-06-12 Thread nicks
@keyan..your advice was really very helpful...the time limit has come under control ...1.4s but now i am getting WA though my code is giving right ans for the test cases...can you plz help me in figuring out where it fails .. On Sun, Jun 12, 2011 at 12:59 AM, keyan karthi wrote: > > hint: u ve co

Re: [algogeeks] Please explain this problem

2011-06-12 Thread keyan karthi
hint: u ve commented some vital part of ur code ;) On Sun, Jun 12, 2011 at 12:46 PM, saurabh singh wrote: > > I did used the library functions but I am getting sigsegv after 0.03 s.I > cant understand why?I am presuming sumthing wrong about the implemenatation > of bsearch? > I am assuming bsear

Re: [algogeeks] Please explain this problem

2011-06-12 Thread saurabh singh
I did used the library functions but I am getting sigsegv after 0.03 s.I cant understand why?I am presuming sumthing wrong about the implemenatation of bsearch? I am assuming bsearch is returning a pointer to the first found element. On Sun, Jun 12, 2011 at 12:41 PM, keyan karthi wrote: > upper_bo

Re: [algogeeks] Please explain this problem

2011-06-12 Thread keyan karthi
upper_bound and lower_bound does a binary search to get count of alike terms.. which u tend to sum of to get the ans.. out of the two arrays, u need to sort one array.. this will be teh vector in which u do the binary search wit every element of un sorted array.. this is the approach i used... :) h

Re: [algogeeks] Please explain this problem

2011-06-12 Thread nicks
and here is my code I'm Getting TLE i tried to implement binary search but failed bcoz how will i be able to trace the value from one vector into another vector if there are any multiple occureneces of any value(i mean i have count them).in this code i i have used count of algorithm which m

Re: [algogeeks] Please explain this problem

2011-06-11 Thread saurabh singh
OK here is my code #include #include #include using namespace std; int compareints (const void * a, const void * b) { return ( *(long*)a - *(long*)b ); } int main() { int n,s[101],a,b,c,d,e,f; long p1[19],p2[19]; int i,j,k; scanf("%d",&n); for(i=0;i=p2&&*(pItem)=

Re: [algogeeks] Please explain this problem

2011-06-11 Thread Terence
a,b,c,d,e,f do not need to be distinct. (It is possible that a=b=c=d=e=f, see Example 1) On 2011-6-10 12:01, saurabh singh wrote: Problem link- ABCDEF Can someone please explain this problem.The problem says a,b,c,d,e,f belongs to S.But what if size of S

Re: [algogeeks] Please explain this problem

2011-06-11 Thread {{Udit Gupta}}
@aditya: can u b more precise?? On Fri, Jun 10, 2011 at 9:14 PM, ADITYA KUMAR wrote: > just visit spoj forums > > > On Fri, Jun 10, 2011 at 9:42 AM, keyan karthi > wrote: > >> the nos can repeat :) ie the valid set may contain multiple instance of >> a same number.. >> hope this helps :) >> >

Re: [algogeeks] Please explain this problem

2011-06-10 Thread ADITYA KUMAR
just visit spoj forums On Fri, Jun 10, 2011 at 9:42 AM, keyan karthi wrote: > the nos can repeat :) ie the valid set may contain multiple instance of a > same number.. > hope this helps :) > > > On Fri, Jun 10, 2011 at 9:31 AM, saurabh singh wrote: > >> Problem link- ABCDEF

Re: [algogeeks] Please explain this problem

2011-06-09 Thread keyan karthi
the nos can repeat :) ie the valid set may contain multiple instance of a same number.. hope this helps :) On Fri, Jun 10, 2011 at 9:31 AM, saurabh singh wrote: > Problem link- ABCDEF > > Can someone please explain this problem.The problem says a,b,c,d,e,

[algogeeks] Please explain this problem

2011-06-09 Thread saurabh singh
Problem link- ABCDEF Can someone please explain this problem.The problem says a,b,c,d,e,f belongs to S.But what if size of S is smaller than 6? I know i am missing sumthing very trivialhelp plz. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD