[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 ema

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 wrote: > it also ran successfully on ideone.com > plz help me > i am classifying the

[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

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 wrote: > No this is f

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 wrote: > will be better if you post on spoj forums.!! > > > On Wednesday, 13 June 2012 01:40:36 UTC+5:30, gaur

[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 "Algorith

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+unsu

[algogeeks] Re: spoj problem

2012-05-13 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)

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 > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@go

Re: [algogeeks] Re: spoj

2012-02-16 Thread atul anand
@ pavan : thanks... @utkarsh : please find attached code..please le me knw if any case fail On Thu, Feb 16, 2012 at 7:02 PM, pavan wrote: > yeah the results are correct for the given inputs > > On Feb 16, 1:03 am, atul anand wrote: > > if i have understood the problem correctly... > > you

[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 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 4 5 6         5 >

Re: [algogeeks] Re: spoj

2012-02-15 Thread atul anand
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 54 2) 1 2 3 4 5 6 5 3) 1 2 3 4 5 6 7 4 4) 1 2 3 4 5 6 7 8 8 On Wed, Feb 15, 2012 at 11:38 PM, Dheeraj Sharma < dhe

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 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 wrote: > > in 1 2 3 4 5 6...o/p "ll b 5 > > -- > You receiv

[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 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" group. To post to thi

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 wrote: > @trinity tell the link of problem ? > > > > *Thanks > Shashank Mani Narayan > Computer Science & Engineering > Birla Ins

[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 G

[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" wrote: > I am getting a lot of tle's for this problem. > > https://www.spoj.pl/problems/BUGLIFE/ > > Here is my code > > #include > #include > #include > using namespace std; > > int

[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 algogeeks@googlegroups

Re: [algogeeks] Re: spoj problem

2011-11-18 Thread Amol Sharma
hi all, i implemented the same problem with bfs but i'm getting TLE.plz tell how to reduce my running time my code is as follows... #include #include #include #include #include #include using namespace std; int main() { int i,f,s,g,u,d;//f=no. of floors,s=start,g=goal,u=up,d=down

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 On Fri,

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 wrote: > U need to check for the case when (s==g) source and destination are > same , I got stuck here , after handling this case I go

[algogeeks] Re: spoj problem

2011-11-16 Thread SAMMM
U need to check for the case when (s==g) source and destination are same , I got stuck here , after handling this case I got accepted :) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegro

[algogeeks] Re: spoj problem

2011-11-16 Thread Dave
It seems like a mathematical solution should be possible. What we want to do is find m >= 0 and n <= 0 so that m * u + n * d = g - s. Pseudocode: If (s + u > f and s - d < 1) or (f - d < g and 1 + u > g) then return "use the stairs". Use the Extended GCD algorithm (http://en.wikipedia.org/wi

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 wrote: > This input > > 100 1 5 5 91 > > Should output 20. Yours says "Take the stairs". > > 100 1 5 5 89 > > Should output 76. Y

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 #include 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

[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 wrote: > problem ishttp://www.spoj.pl/problems/ELEVTRBL/ > and my solution is give wrong answer on spoj . Plz help me to

[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 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 =  number of times to pr

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-14 Thread Don
I solved this one with a breadth-first search. Don On Nov 14, 8:27 am, Anshul AGARWAL 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. > > * > #include > ** > #include > usi

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 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 wrote: > > http://www.spoj.pl/problems/PIGBANK/ > > > > please suggest some test case where it fails

[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 wrote: > http://www.spoj.pl/problems/PIGBANK/ > > please suggest some test case where it fails ... > > [code] > #include > main() > {    int t=0,n,e,f,i,j; >     int p[50002],w[10002]

Re: [algogeeks] Re: SPOJ problem

2011-09-17 Thread amrit harry
@dave +1 On Sat, Sep 17, 2011 at 8:10 PM, Dave 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 harry wrote: > > h

[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 wrote: > http://www.spoj.pl/problems/POUR1/ > hw the 2nd given test is correct. >

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+unsubscr...@googlegr

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

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--)

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 ema

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("");

[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 algogeeks+unsubscr...@googlegroup

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+unsubscr...@

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 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, keyankarthi wrot

[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 wrote: > http://www.spoj.pl/problems/MAIN8_D/ > > i tried solving this problem > any ideas...?? > for second test case 'htht' > the states i considere

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. Fo

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 wrote: > 3 > eee > cjpvbhntzgm > > aeiouaeiouae > vfghjklwerf > eouaeioicou > > On Wed, Aug 10, 2011 at 12:06 PM, kartik sachan > wrote: >

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 wrote: > 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 grou

[algogeeks] Re: SPOJ CENCRY

2011-08-09 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 op

[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, >> while(count[k-'A'].second>=n||count[k-'A'].first==up[i]||count[k-'

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 wrote: > Use lazy propagation. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm

[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 unsu

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 stil

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 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, mos

[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 algogeeks+unsubscr...@goo

[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 ema

[algogeeks] Re: SPOJ Problem DP

2011-07-02 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 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 ? > > PS : Don'

[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+unsubscr...@googlegro

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-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

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 f

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 wrote: > any one plzz reply > > -- > You received this message because you are subscr

[algogeeks] Re: SPOJ GPA1

2011-06-29 Thread kartik sachan
any one plzz reply -- 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 op

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread D!leep Gupta
@vaibhav :acc. to u Its giving 9 for "BGBBGGGBBBGBGB" bt it should be 8 how? my code: #include 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') { if(

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. F

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
just count the how many shift u required to shift last G from (right to left)...to reach it postion.but be carefull as there are the situation and steps in which last G will not move ex GGGBGBGBBBB -- You received this message because you are subscribed to the

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread ankit sambyal
@kartik : What is ur logic ?? -- 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 opt

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 Grou

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 algogeeks+unsubscr...@goog

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 wrote: > @ 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

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 becau

Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread vaibhav agarwal
@kartik it's wrng got it On 6/28/11, vaibhav agarwal wrote: > @kartik the sequence 101001100011000101101101011 can be done > in 25 iterations > whts urs? > > On 6/28/11, kartik sachan wrote: >> anonymous u have to play with the index no of either G or >> B...and see how many

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 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 then max will be the

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 t

[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 Ge

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 wrote: > @VAIBHAV.ur logic fails in many > cases...like G > > -- > You received this message because you are s

Re: [algogeeks] Re: spoj shlights

2011-06-27 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 g

Re: [algogeeks] Re: spoj shlights

2011-06-27 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 algogeeks+unsubscr...@googleg

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-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 n

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
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 th

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 :-) wrote: > Can one of you provide some hints in solving this problem ? > > > On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan wrote: > >> @jitendra that's what i am asking forwhat a

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 wrote: > @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 Go

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 t

[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 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 wrote: > > > > > QUESTION LINK IShttp://www.spoj.pl/problems/SHLIGHTS/

[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 algogeeks+unsu

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, shady

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 . wrote: > 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, answ

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 wrote: > O.K can anyone suggest the combinatorial solution.I thought it this way- > Assume k chair

Re: [algogeeks] Re: spoj problem chairs

2011-06-20 Thread saurabh singh
O.K can anyone suggest the combinatorial solution.I thought it this way- Assume k chairs as one chair.Now no. of ways arranging these chairs would be ((n-k+1)-1)! and the number of ways of arranging the k chairs would be k!. So the no. of ways of arranging the chairs so that they are always togethe

[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 wrote: > @above   Better you ask it on spoj forum > > On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh wrote: > > I am getting WA for this problem.I dont kno

Re: [algogeeks] Re: spoj NKTM

2011-06-15 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+unsubsc

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 wrote: > Whats ur running time. Mine is 0.05 without using priority queque. > > > On Wed, Jun 15, 2011 at 8:24 PM, kartik sachan wrote: > >> ya dude finally i applied that algo only >> >> -- >> You received this

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 wrote: > 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 grou

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. F

[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 algogeeks@googlegroups.

[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 mor

[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+uns

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
im sorry .. y wrote: > yea.. now got ac.. :) mistake was k==y is also possible but x got WA .. thank u :) > > On Sat, Jun 11, 2011 at 2:39 PM, keyan karthi > wrote: > >> 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 Rengan

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
yea.. now got ac.. :) mistake was k==y is also possible but xwrote: > 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.com> wrote: > >> i did the same prob wit range maximum query.. but im repeate

  1   2   3   >