[gcj] Approach to "Killer Word"

2013-03-28 Thread amit
https://code.google.com/codejam/contest/1145485/dashboard#s=p1&a=1 I was trying codejam 2011 questions. I got stuck at Round 1A question Killer Word. I checked out a solution in C attached with the post. I just want to know how one approached to that solution? -- You received this message beca

Re: [gcj] Error In Output

2013-03-28 Thread Carlos Guia
For me to help you I ask again for a link to the original problem, that'd be quite helpful. About math and standard algorithms, you certainly need a bit of both for the contests. You can start with TopCoder's tutorials: www.topcoder.com/tc?d1=tutorials&d2=alg_index&module=Static If you want to bu

Re: [gcj] Error In Output

2013-03-28 Thread mandeep
ok..i got it..i just want you to check my solutionbecause when i submit it online..it shows wrong answer(don't know for what test case) And one more thing i find that many of programming problem are mathematical and it don't use standered algorithm and i'm not good in mathematical algo..so

Re: [gcj] Error In Output

2013-03-28 Thread Carlos Guia
I see, that makes sense since that number does grow pretty fast. Well, I'm not sure you still have questions, but if you're still struggling, ping back after some trying. You should already have enough information on what to look for to solve the first part. Carlos Guía On Thu, Mar 28, 2013 at

Re: [gcj] Why is this output wrong ?

2013-03-28 Thread Ayman Mohamed
thanks a lot :) On Thu, Mar 28, 2013 at 4:16 PM, Paul Smith wrote: > My calculator says "791". And by my calculator I mean Windows calculator. > > Paul Smith > > p...@pollyandpaul.co.uk > > > On Tue, Mar 26, 2013 at 10:56 PM, Ayman Mohamed < > mahone.alexande...@gmail.com> wrote: > >> Could yo

Re: [gcj] Why is this output wrong ?

2013-03-28 Thread Paul Smith
My calculator says "791". And by my calculator I mean Windows calculator. Paul Smith p...@pollyandpaul.co.uk On Tue, Mar 26, 2013 at 10:56 PM, Ayman Mohamed < mahone.alexande...@gmail.com> wrote: > Could you tell me you answer when n=28 ? > > > On Tue, Mar 26, 2013 at 11:21 PM, Paul Smith wro

Re: [gcj] Error In Output

2013-03-28 Thread mandeep
yeah you are right...i used module because after finding this you will also have to find no of ways to choose a captain from a particular path...if u have {1,2} {3,4} {5} then no of ways will be {1,3,5},{1,4,5}{2,3,5},{2,4,5} that is 4...that why i have used module above... On 28 March 2013 18:23

Re: [gcj] Error In Output

2013-03-28 Thread Carlos Guia
Could paste a link top the problem? I see your code is using modulo 17 arithmetic, I don't expect a connected components problem top have that requirement as the graph would have to be huge for it to make sense. Reading the original problem might show what actually needs to be done is anth

Re: [gcj] Error In Output

2013-03-28 Thread Carlos Guia
You can DFS or BFS, they run linear time with respect the graph size. There are faster ways, the terms Joseph used(combine sets) strongly indicates he's hinting on using disjoint-sets (aka. union-find). Search for: number of connected components Carlos Guia On Mar 28, 2013 9:09 AM, "mandeep" wro

Re: [gcj] Error In Output

2013-03-28 Thread mandeep
but DFS will be used to implement this problem On 28 March 2013 17:27, Joseph DeVincentis wrote: > Start with {1},{2},{3},{4},{5},{6},{7},{8},{9},{10} > When you see 1 2, combine those sets: {1, > 2},{3},{4},{5},{6},{7},{8},{9},{10} > Likewise for 3 4 and 6 7: {1, 2},{3, 4},{5},{6, 7},{8},{

Re: [gcj] Error In Output

2013-03-28 Thread Joseph DeVincentis
Start with {1},{2},{3},{4},{5},{6},{7},{8},{9},{10} When you see 1 2, combine those sets: {1, 2},{3},{4},{5},{6},{7},{8},{9},{10} Likewise for 3 4 and 6 7: {1, 2},{3, 4},{5},{6, 7},{8},{9},{10} When you get 1 4 you combine the two sets containing them: {1, 2, 3, 4},{5},{6, 7},{8},{9},{10} On Thu

Re: [gcj] Error In Output

2013-03-28 Thread mandeep
Ok..well i forgot to add something here... if input is you have 10 elements and those pair who will share the same path is 1 2,3 4,6 7,1 4 then set will be {1,2,3,4},{5},{6,7},{8},{9},{10} that is output should be 6.. now tell me how to implement this problem... thanks a lot... On 28 March 2013