[algogeeks] Re: spoj problem EASYMATH

2012-09-27 Thread gaurav yadav
thanx :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/iy_uho_bmMYJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from

[algogeeks] Re: spoj problem EASYMATH

2012-09-26 Thread gaurav yadav
an idea of the approach would be enough.. plz help.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/3H3O2K4KBBMJ. To post to this group, send email

[algogeeks] Re: spoj problem : POKER

2012-06-18 Thread Mayank Singh
it also ran successfully on ideone.com plz help me i am classifying the card in two parts: one with same suit and other with different suit... plz let me know if futher explanation is needed abt the code help me regarding this.. thanx -- You received this message because you are subscribed

Re: [algogeeks] Re: spoj problem : POKER

2012-06-18 Thread Pranjal Patil
Your code fails on one of the test cases like 5H 6H 7H 8H 9H. it should give straight flush instead of flush, Think of all such cases are change accordingly .. On Mon, Jun 18, 2012 at 10:01 PM, Mayank Singh singh13490may...@gmail.com wrote: it also ran successfully on ideone.com plz help me i

[algogeeks] Re: spoj problem

2012-06-13 Thread shiv narayan
will be better if you post on spoj forums.!! On Wednesday, 13 June 2012 01:40:36 UTC+5:30, gaurav yadav wrote: plz nyone explain how to approach this problem.. http://www.spoj.pl/problems/XORROUND/ -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: spoj problem

2012-06-13 Thread saurabh singh
No this is fair enough.It directly involves algorithm. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Thu, Jun 14, 2012 at 4:28 AM, shiv narayan narayan.shiv...@gmail.comwrote: will be better if you post on spoj forums.!! On Wednesday, 13 June 2012

Re: [algogeeks] Re: spoj problem

2012-06-13 Thread Sourabh Singh
@ saurabh singh : what algorithm can be used ?? coz.. i did it by simple observation. 1) just take any sequence of numbers. 2) write it's first 5-6 xor round's. 3) now luk for some pattern. u'll get the answer : ) On Wed, Jun 13, 2012 at 9:46 PM, saurabh singh saurab...@gmail.com

Re: [algogeeks] Re: spoj problem

2012-05-15 Thread ashish pant
@lucifer nice approach for calculating median.. thanks for the help -- 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

[algogeeks] Re: spoj problem

2012-05-14 Thread Lucifer
O(n) approach for finding the height of the stacks.. - First take 2 arrays A[n] and B[n], where A keeps track of the no. of times a start index(the start query index) occurs. and B keeps track of the no. of times a end index(the end query index)

[algogeeks] Re: spoj

2012-02-16 Thread pavan
yeah the results are correct for the given inputs On Feb 16, 1:03 am, atul anand atul.87fri...@gmail.com wrote: if i have understood the problem correctly... you please confirm the answers i am getting for the given inputs:-                           result 1) 1 2 3 4 5            4 2) 1 2 3

Re: [algogeeks] Re: spoj

2012-02-16 Thread Kartik Sachan
@atul by doing through link list it will give TLEu have to derive some kind of formula .. and till now i am unable to find that kartik.sac...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Re: spoj

2012-02-15 Thread pavan
@Utkarsh: yeah it is josephsus problem with a slight change.using a linked list will give u TLE i guess. On Feb 14, 10:36 pm, vickywiz vickywiz...@gmail.com wrote: in 1 2 3 4 5 6...o/p ll b 5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: spoj

2012-02-15 Thread Dheeraj Sharma
yeah..we need to calculate some formula On Wed, Feb 15, 2012 at 10:21 PM, pavan pavankri...@gmail.com wrote: @Utkarsh: yeah it is josephsus problem with a slight change.using a linked list will give u TLE i guess. On Feb 14, 10:36 pm, vickywiz vickywiz...@gmail.com wrote: in 1 2 3 4 5

[algogeeks] Re: Spoj ABCPATH

2012-02-05 Thread WgpShashank
@trinity tell the link of problem ? *Thanks Shashank Mani Narayan Computer Science Engineering Birla Institute of Technology,Mesra ** Founder Cracking The Code Lab http://shashank7s.blogspot.com/* -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: Spoj ABCPATH

2012-02-05 Thread saurabh singh
http://www.spoj.pl/problems/ABCPATH/ Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Sun, Feb 5, 2012 at 11:18 PM, WgpShashank shashank7andr...@gmail.comwrote: @trinity tell the link of problem ? *Thanks Shashank Mani Narayan Computer Science

[algogeeks] Re: SPOJ TLE

2011-12-20 Thread KK
Try wid BFS.. thats the only alternative i can think off!! I got acc wid that!! On Dec 6, 12:29 pm, varma C.S.P verma@gmail.com wrote: I am getting a lot of tle's for this problem. https://www.spoj.pl/problems/BUGLIFE/ Here is my code #includeiostream #includecstdio #includecstring

[algogeeks] Re: SPOJ . 10186.PUCMM025

2011-12-15 Thread anubhav raj
hey ,i got the bug and got AC ALSO..there was several bugs ...sry ,for silly dbt -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: spoj problem

2011-11-18 Thread Amol Sharma
don't bother got AC was doing lot of extra overhead -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99 On Fri, Nov

Re: [algogeeks] Re: spoj problem

2011-11-17 Thread Anshul AGARWAL
finally got AC,(using bfs) thanx DON for provide such nice test case *Anshul Agarwal Nit Allahabad Computer Science** * On Wed, Nov 16, 2011 at 8:14 PM, SAMMM somnath.nit...@gmail.com wrote: U need to check for the case when (s==g) source and destination are same , I got stuck here , after

Re: [algogeeks] Re: spoj problem

2011-11-16 Thread UTKARSH SRIVASTAV
hi don i have now implemented it with bfs but it's still giving wrong answer can you please tell the test case #includestdio.h int a[1000100][2]; int visited[1000100],i,q[1000100]; int main() { int f,s,g,u,d; scanf(%d%d%d%d%d,f,s,g,u,d); for( i = 1 ; i = f;i++) { if(i + u

Re: [algogeeks] Re: spoj problem

2011-11-16 Thread Anshul AGARWAL
thanx Don. i think my logic is not so good . now i try to make it using bfs . *Anshul Agarwal Nit Allahabad Computer Science** * On Tue, Nov 15, 2011 at 5:36 PM, Don dondod...@gmail.com wrote: This input 100 1 5 5 91 Should output 20. Yours says Take the stairs. 100 1 5 5 89 Should

Re: [algogeeks] Re: spoj problem

2011-11-15 Thread UTKARSH SRIVASTAV
hi don please tell me where am i wrong in this maths in solving this question. let x = number of times to press up button let y = number of times to press down button k = g -s so we have u*x - d*y = k ---(1) we have to minimize x + y so from (1) x = (k+d*y)/u; x +

[algogeeks] Re: spoj problem

2011-11-15 Thread Don
I don't think that your solution assures that the elevator stays in its bounds. Don On Nov 15, 12:49 pm, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: hi don please tell me where am i wrong in this maths in solving this question.      let x = number of times to press up button let y =  

[algogeeks] Re: spoj problem

2011-11-15 Thread Don
This input 100 1 5 5 91 Should output 20. Yours says Take the stairs. 100 1 5 5 89 Should output 76. Yours says Take the stairs. Don On Nov 14, 8:27 am, Anshul AGARWAL anshul.agarwa...@gmail.com wrote: problem ishttp://www.spoj.pl/problems/ELEVTRBL/ and my solution is give wrong answer on

[algogeeks] Re: spoj problem

2011-11-14 Thread Don
I solved this one with a breadth-first search. Don On Nov 14, 8:27 am, Anshul AGARWAL anshul.agarwa...@gmail.com wrote: problem ishttp://www.spoj.pl/problems/ELEVTRBL/ and my solution is give wrong answer on spoj . Plz help me to find in which case my solution give wrong answer. *

Re: [algogeeks] Re: SPOJ PIGBANK Problem

2011-09-30 Thread manish patel
thanks man i got it .. :) On Fri, Sep 30, 2011 at 12:17 AM, Don dondod...@gmail.com wrote: I think that it will fail if the value of the coins can be more than 50001. Don On Sep 29, 12:35 pm, manish patel manispatel...@gmail.com wrote: http://www.spoj.pl/problems/PIGBANK/ please

[algogeeks] Re: SPOJ PIGBANK Problem

2011-09-29 Thread Don
I think that it will fail if the value of the coins can be more than 50001. Don On Sep 29, 12:35 pm, manish patel manispatel...@gmail.com wrote: http://www.spoj.pl/problems/PIGBANK/ please suggest some test case where it fails ... [code] #includestdio.h main() {    int t=0,n,e,f,i,j;    

[algogeeks] Re: SPOJ problem

2011-09-17 Thread Dave
@Amrit: You only have 2 and 3 litre jars. You are trying to get 4 litres into one of them. There is no 4 litre jar, nor any other vessel into which you can capture the 4 litres. Dave On Sep 17, 6:15 am, amrit harry dabbcomput...@gmail.com wrote: http://www.spoj.pl/problems/POUR1/ hw the 2nd

Re: [algogeeks] Re: SPOJ problem

2011-09-17 Thread amrit harry
@dave +1 On Sat, Sep 17, 2011 at 8:10 PM, Dave dave_and_da...@juno.com wrote: @Amrit: You only have 2 and 3 litre jars. You are trying to get 4 litres into one of them. There is no 4 litre jar, nor any other vessel into which you can capture the 4 litres. Dave On Sep 17, 6:15 am, amrit

Re: [algogeeks] Re: SPOJ ACODE

2011-08-28 Thread Amol Sharma
I/P 30 105 1055 0 O/P 0 1 1 your code gives 1 1 1 (Copied from comments below the statement on Spoj ) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

Re: [algogeeks] Re: SPOJ ACODE

2011-08-28 Thread kartik sachan
THANKs amol piyush i got my mistake -- 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

[algogeeks] Re: SPOJ ACODE

2011-08-27 Thread kartik sachan
koyi to test cases de jisme mera code fail kare? -- 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

Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread Piyush Kapoor
You can check your answers on my AC code:: import java.io.*; import java.util.*; public class Main { public static void main(String args[])throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); StringBuffer out=new StringBuffer();

Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread kartik sachan
thanks piyush for replying but i don't have complier for java and i don't know even java -- 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

Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread Piyush Kapoor
There is nothing much particular to java,, Here is the code(simply copy pasted from the above one) in C:: int main(){ char ar[100]; int dp[1000]; scanf(%s,ar); if(ar[l-1]!='0') dp[l-1]=1; for(int j=l-2;j=0;j--)

[algogeeks] Re: spoj coin tossing

2011-08-24 Thread him
1st one H-2^1+1 HTHT-2^4+4 TTHTHTHTHTHHTHTHTHTTHTHTT(33) - 2^33+6(why)? do you see any connection? On Aug 24, 6:55 am, keyankarthi keyankarthi1...@gmail.com wrote: http://www.spoj.pl/problems/MAIN8_D/ i tried solving this problem any ideas...?? for second test case 'htht' the

Re: [algogeeks] Re: spoj coin tossing

2011-08-24 Thread Piyush Kapoor
@keyan karthi Can you explain a bit on how to use the markov chain to get the answer... On Wed, Aug 24, 2011 at 11:42 PM, him himanshuarora.1...@gmail.com wrote: 1st one H-2^1+1 HTHT-2^4+4 TTHTHTHTHTHHTHTHTHTTHTHTT(33) - 2^33+6(why)? do you see any connection? On Aug 24, 6:55 am,

Re: [algogeeks] Re: spoj coin tossing

2011-08-24 Thread Aastha Rai
hey! the solution can be found by summation from 1 to n + n -- 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

[algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
any body tell the test cases?? -- 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 algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread Nitin Nizhawan
3 eee cjpvbhntzgm aeiouaeiouae vfghjklwerf eouaeioicou On Wed, Aug 10, 2011 at 12:06 PM, kartik sachan kartik.sac...@gmail.comwrote: any body tell the test cases?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread Nitin Nizhawan
inp: 3 eee vfghjklwerf out: cjpvbhntzgm aeiouaeiouae eouaeioicou On Wed, Aug 10, 2011 at 12:40 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: 3 eee cjpvbhntzgm aeiouaeiouae vfghjklwerf eouaeioicou On Wed, Aug 10, 2011 at 12:06 PM, kartik

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
thanks nitin got AC...:) silliy mistake -- 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 algogeeks+unsubscr...@googlegroups.com. For

[algogeeks] Re: SPOJ ABCD

2011-08-07 Thread amit karmakar
@amol I got accepted using the similar approach. But i performed backtracking. In each step of backtracking i chose the next option as you done. So, there can be cases where this approach fails. Runtime error may occur because,

[algogeeks] Re: SPOJ LITE

2011-08-01 Thread Rohan Kalra
Use lazy propagation. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/3YMdS5bKx_sJ. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] Re: SPOJ LITE

2011-08-01 Thread Amol Sharma
can u explain or some useful link ?? -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Mon, Aug 1, 2011 at 10:16 PM, Rohan Kalra ronziiretu...@gmail.comwrote: Use lazy propagation. -- You received this message because you are subscribed to the Google

[algogeeks] Re: SPOJ

2011-07-25 Thread KK
@shady: if ur not interested dont post ur comment, but let others do it.. @viswamath: WA -- 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

[algogeeks] Re: SPOJ

2011-07-25 Thread KK
@piyush: even if r = di and c = dj then whats the prob?? -- 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

Re: [algogeeks] Re: SPOJ

2011-07-25 Thread sunny agrawal
First Thing is that i will support Shady's point. Please Post the question and the idea u r trying to solve the questionnot the complete Code so that algorithm can be discussed here and then u can identify your mistake. because this happens most of the time when someone posts code,

Re: [algogeeks] Re: SPOJ

2011-07-25 Thread shady
thanks sunny. KK this is not your playground. People from all over the world are in this group. These are the people who have left companies like MS because of their love for algorithms discuss ideas. Only way you learn debugging is by practice. Once it took me 5 continuous hours to debug one

Re: [algogeeks] Re: SPOJ

2011-07-25 Thread shady
I request you all to concentrate on algorithms and not the bits of coding. When your code is giving WA on any judge then please first state your algorithm. Take feedback from fellow users. If it is wrong then try debugging it your self, corner cases, and even after spending 3-4 days if you are

[algogeeks] Re: SPOJ Problem DP

2011-07-03 Thread shady
any spojjer in the group ? if you want i can post my solution with djikstra's :P ? Shady On Sat, Jul 2, 2011 at 10:31 AM, shady sinv...@gmail.com wrote: Hi, I am solving this http://www.spoj.pl/problems/DP/ problem using Djikstra's algorithm. What is the dynamic programming solution to this

Re: [algogeeks] Re: SPOJ GPA1

2011-07-01 Thread kartik sachan
@thanks ceg sirfinally got acceptedur test case worked..silly mistake...= error -- 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.

[algogeeks] Re: SPOJ GPA1

2011-07-01 Thread cegprakash
its ok :) but i'm not sir n all.. i'm a student :P -- 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

[algogeeks] Re: SPOJ GPA1

2011-06-30 Thread cegprakash
@kartik sachan: I just compared your output file with the output file for this test case 5 1 2 3 4 5 19 ab ab 100 50 20 20 20 75 75 10 0 ab 88 0 13 12 15.5 88 99 12 7 9 66 66 11 ab ab 99 100 your code outputs FAILED, 4.35 but actually he's PASSED, 7.20 I think you are assuming he's fail if he

Re: [algogeeks] Re: spoj shlights

2011-06-29 Thread D!leep Gupta
@vaibhav :acc. to u Its giving 9 for BGBBGGGBBBGBGB bt it should be 8 how? my code: #includestdio.h int main() { int t; scanf(%d,t); while(t--) { int i=0,s=0,count=0,c=0,flag=1; char a[15],ch; scanf(%s,a); while(a[i]!='\0') {

Re: [algogeeks] Re: SPOJ GPA1

2011-06-29 Thread sunny agrawal
hey how r u dealing with absent cases. for each case u r directly converting string to float but for absent u will call atof() for ab and compare it. On Wed, Jun 29, 2011 at 11:02 PM, kartik sachan kartik.sac...@gmail.comwrote: any one plzz reply -- You received this message

Re: [algogeeks] Re: SPOJ GPA1

2011-06-29 Thread kartik sachan
@sunny atof(ab) is giving me as zero.so it will not affect the calculation i think so... -- 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

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
GOT AC IN .02 SEC .:))) -- 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

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
@VAIBHAV.ur logic fails in many cases...like G -- 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

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread vaibhav agarwal
@kartik well i hv written before trailing G's can be left in calculation so it works fr GG. On 6/28/11, kartik sachan kartik.sac...@gmail.com wrote: @VAIBHAV.ur logic fails in many cases...like G -- You received this

[algogeeks] Re: spoj shlights

2011-06-28 Thread anonymous procrastination
@Kartik Please tell me what logic you're following. @varun This strategy failed. I tried submitting. GBGBBGGBBBGGBBBGBGGBGGBGBGG 101001100011000101101101011 You can try the above case. -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
anonymous u have to play with the index no of either G or B...and see how many shift it will require to reach it original postion then max will be the ans.. well GBGBBB if we start from right to left then G=3 and G=5 first G have reach to 0 pos and second G have to reach

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread vaibhav agarwal
@kartik the sequence 101001100011000101101101011 can be done in 25 iterations whts urs? On 6/28/11, kartik sachan kartik.sac...@gmail.com wrote: anonymous u have to play with the index no of either G or B...and see how many shift it will require to reach it original postion

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread vaibhav agarwal
@kartik it's wrng got it On 6/28/11, vaibhav agarwal vibhu.bitspil...@gmail.com wrote: @kartik the sequence 101001100011000101101101011 can be done in 25 iterations whts urs? On 6/28/11, kartik sachan kartik.sac...@gmail.com wrote: anonymous u have to play with the index no of

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
@ vaibhav i have submitted my concept in spoj and it got AC in .02 sec i am saying for u have to play with index of EITHER of G or B now u have to think logic by taking two or more exmaple and shift it in...do it in paperu will see some pattern -- You received this message

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread sagar pareek
Well can anyone pls re post the problem? On Tue, Jun 28, 2011 at 3:20 PM, kartik sachan kartik.sac...@gmail.comwrote: @ vaibhav i have submitted my concept in spoj and it got AC in .02 sec i am saying for u have to play with index of EITHER of G or B now u have to think logic by taking two

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
http://www.spoj.pl/problems/SHLIGHTS/ this is the link -- 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

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread ankit sambyal
@vaibhav agarwal: case 3 of urs gives ans 6 according to ur algo, but the correct ans is 5 also the following test case also gives wrong ans with ur algo : GBBGBBBB Ur algo give - 9 Correct ans-- 7 -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
if u want code then mail me. -- 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 algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread pacific :-)
Can one of you provide some hints in solving this problem ? On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan kartik.sac...@gmail.comwrote: @jitendra that's what i am asking forwhat algo i should implement to get process in 1 sec? -- You received this message because you are

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread harshit pahuja
hint is : go for counting ,not for shifting o(n). :P On Mon, Jun 27, 2011 at 9:29 PM, pacific :-) pacific4...@gmail.com wrote: Can one of you provide some hints in solving this problem ? On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan kartik.sac...@gmail.comwrote: @jitendra that's what

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread vaibhav agarwal
consider G as 1, B as 0 so actually its series of 1 and 0's now consider any sequence GBGBBGGGBG will be represented as 1010011101 objective is to push all 1's at the right end. all '10' pairs need to be swapped at the same time. considering this take for ex 101 the number of swaps is equal to

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread kartik sachan
HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS CASE GBGBBB -- 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

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread vaibhav agarwal
@kartik yup frgt to mention the last case 1 followed by zero's in that case number of iterations is the no. of trailing zeroes. GBGBBB will have four iterations 101000 = 1(one zero b/w two ones) + 3(last 1 followed by 3 zero's) BGBGBB,BBGBGB,BBBGBG,GG well logic is how hw mny jump of 1's u

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread vaibhav agarwal
@kartik also consider the case of GB the answer is 1 BG. ie trailing G's left. BGB leading B's left hence only one G followed by B therefore only one iteration. try out some cases u will find hw it wrks. On Tue, Jun 28, 2011 at 12:42 AM, vaibhav agarwal vibhu.bitspil...@gmail.com

Re: [algogeeks] Re: spoj shlights

2011-06-25 Thread kartik sachan
@jitendra that's what i am asking forwhat algo i should implement to get process in 1 sec? -- 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

[algogeeks] Re: spoj shlights

2011-06-24 Thread anonymous procrastination
Hello, Were you able to figure out the solution? On Jun 23, 3:33 pm, Jitendra singh jsinghrath...@gmail.com wrote: @ kartik sachan Problem with this code is this- All GB pairs should be process in one time period On 6/23/11, kartik sachan kartik.sac...@gmail.com wrote: QUESTION LINK

[algogeeks] Re: spoj problem chairs

2011-06-22 Thread VIHARRI
@saurabh : The answer suggested by you is for not all together... -- 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

Re: [algogeeks] Re: spoj problem chairs

2011-06-21 Thread shady
what will be the dynamic programming solution to the above problem ? can anyone explain the states of the dp ? On Mon, Jun 20, 2011 at 6:53 PM, oppilas . jatka.oppimi...@gmail.comwrote: I think you have not read the question carefully. Please read it again and try to ans for small values of

Re: [algogeeks] Re: spoj problem chairs

2011-06-21 Thread keyan karthi
dp(int chair,int person,bool previous) if(previous) dp(chair-1,person,0) else dp(chair-1,person-1,1)+dp(chair-1,person,0) with basic conditions as it is a circle.. if person is placed in first chair u cant place a person in last chair On Tue, Jun 21, 2011 at 7:38 PM,

[algogeeks] Re: spoj problem chairs

2011-06-20 Thread RITESH SRIVASTAV
@Saurabh Your formula is incorrect. for input : 5 2 the answer should be 5 but your program gives 12 as output. On Jun 19, 11:35 pm, abc abc may.i.answ...@gmail.com wrote: @above   Better you ask it on spoj forum On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh saurab...@gmail.com wrote: I am

Re: [algogeeks] Re: spoj problem chairs

2011-06-20 Thread oppilas .
I think you have not read the question carefully. Please read it again and try to ans for small values of n,k first. for k=1, answer will be always 1. On Mon, Jun 20, 2011 at 6:31 PM, saurabh singh saurab...@gmail.com wrote: O.K can anyone suggest the combinatorial solution.I thought it this

Re: [algogeeks] Re: spoj NKTM

2011-06-16 Thread kartik sachan
without priority queue its .08 and with priority queue its .0.00 -- 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

[algogeeks] Re: spoj NKTM

2011-06-15 Thread KK
This q increased my score by directly 3 points... and thats a huge one.. :D @ kartik - Do it by priorty queue for better efficiency.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: spoj NKTM

2011-06-15 Thread kartik sachan
ya dude finally i applied that algo only -- 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 algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: spoj NKTM

2011-06-15 Thread Kunal Yadav
Whats ur running time. Mine is 0.05 without using priority queque. On Wed, Jun 15, 2011 at 8:24 PM, kartik sachan kartik.sac...@gmail.comwrote: ya dude finally i applied that algo only -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: spoj NKTM

2011-06-15 Thread sunny agrawal
0.00 with priority_queue stl for me :) On Thu, Jun 16, 2011 at 10:55 AM, Kunal Yadav kunalyada...@gmail.comwrote: Whats ur running time. Mine is 0.05 without using priority queque. On Wed, Jun 15, 2011 at 8:24 PM, kartik sachan kartik.sac...@gmail.comwrote: ya dude finally i applied that

[algogeeks] Re: spoj NKTM

2011-06-14 Thread kartik sachan
got AC silliy mistake i am sorting array only one time.. -- 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

[algogeeks] Re: spoj NKTM

2011-06-14 Thread kartik sachan
case like 5 1 2 3 45 got worng ans -- 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 algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
i did the same prob wit range maximum query.. but im repeatedly getting wrong answer.. im stuck with this prob for a long time.. pls help.. my code: #includeiostream using namespace std; #includestdlib.h #includestdio.h int A[50010]; int M[999]; void initialize(int node, int b, int e) {

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread keyan karthi
k=query(x,y-1) if(k==x) count++ with this change ur code ACs :) On Sat, Jun 11, 2011 at 1:24 PM, Radhika Renganathan radi.coo...@gmail.comwrote: i did the same prob wit range maximum query.. but im repeatedly getting wrong answer.. im stuck with this prob for a long time.. pls help.. my

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
yea.. now got ac.. :) mistake was k==y is also possible but xk fails.. so got WA .. thank u :) On Sat, Jun 11, 2011 at 2:39 PM, keyan karthi keyankarthi1...@gmail.comwrote: k=query(x,y-1) if(k==x) count++ with this change ur code ACs :) On Sat, Jun 11, 2011 at 1:24 PM, Radhika Renganathan

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
im sorry .. yk fails :D On 6/11/11, Radhika Renganathan radi.coo...@gmail.com wrote: yea.. now got ac.. :) mistake was k==y is also possible but xk fails.. so got WA .. thank u :) On Sat, Jun 11, 2011 at 2:39 PM, keyan karthi keyankarthi1...@gmail.comwrote: k=query(x,y-1) if(k==x)

[algogeeks] Re: SPOJ THRBL

2011-06-10 Thread KK
Search Topcoder Tutorial Range Minimum Query @ Google... By few intuitive changes u can implement Range Maximum Query as well... -- 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.

[algogeeks] Re: SPOJ IMPORT

2011-06-09 Thread kartik sachan
its done silly mistake...:( -- 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 algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: SPOJ IMPORT

2011-06-09 Thread saurabh singh
lol.Don't bother.I too have fallen for scan till EOF scheme On Fri, Jun 10, 2011 at 1:58 AM, kartik sachan kartik.sac...@gmail.comwrote: its done silly mistake...:( -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: SPOJ IMPORT

2011-06-09 Thread saurabh singh
look for overlapping subproblems.Most of such problems have a recursive solution possible with time complexity o(2^n) and using dp we can reduce the subproblems and get solution of order polynomial.Thats one way of recognizing dp problems. On Fri, Jun 10, 2011 at 11:14 AM, kartik sachan

Re: [algogeeks] Re: SPOJ problem- TRICOUNT

2011-06-04 Thread Anirudh S
I am still working on arriving at a recursive solution but these links might help. http://mathworld.wolfram.com/TriangleTiling.html http://oeis.org/A002717 http://oeis.org/A002717 On Mon, Mar 21, 2011 at 5:50 PM, cegprakash cegprak...@gmail.com wrote: hello... someone plz tell me how to arrive

[algogeeks] Re: SPOJ problem- TRICOUNT

2011-06-04 Thread Dave
Also http://www.mathematik.uni-bielefeld.de/~sillke/SEQUENCES/grid-triangles. Dave On Jun 4, 8:28 am, Anirudh S anirudh24se...@gmail.com wrote: I am still working on arriving at a recursive solution but these links might help. http://mathworld.wolfram.com/TriangleTiling.html

Re: [algogeeks] Re: spoj--two squares problem

2011-05-29 Thread Vishal Jain
Hi Saurabh, Can you try it for 10? Could not really understand, what are you gonna communicate? 10 = 2*5 (2^2 + 1^2 )*(1*2 + 1^2)... If with this logic you are saying 10 is prime then all numbers divisible by 5 should be prime. Could you elaborate your answer more? Thanks Regards Vishal Jain

  1   2   >