[gcj] Re: Multibase Happiness

2009-09-12 Thread MntlChaos
Why would you do that? It's happy if it ever reaches 1. If it gets into a different loop, it's unhappy. However, you are correct that 8 is not happy in base 10: 8 => 64 => 52 => 29 => 85 => 89 => 145 => 42 => 20 => 4 => 16 => 37 => 58 => 89, at which point we have a cycle (89 appeared twice). But

[gcj] Re: Round 1A | Problem C. Collecting Cards

2009-09-12 Thread qasim zeeshan
Thanks! But I am still not able to understand that how you got f(1)=2 and f(2)=3? On Sat, Sep 12, 2009 at 12:39 PM, bas wrote: > > Let f(k) be the expected number of packs we need to buy if we still > don't have k cards (or we have C-k cards). > To solve the problem we need to find f(C). Note

[gcj] Re: Why Quebec ?

2009-09-12 Thread Ralph Furmaniak
Plus they may need to pay Quebec 10% of the prize money off the bat: http://contests.about.com/od/sweepstakes101/f/VoidinQuebec.htm On Fri, Sep 11, 2009 at 10:10 PM, Jelani Nelson wrote: > > http://en.wikipedia.org/wiki/Charter_of_the_French_Language#Fundamental_language_rights > > The fundamenta

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Sumudu
I haven't implemented this myself (thought of it over dinner), but reducing the search space using the fact that permuting digits doesn't affect the happiness of a number could reduce the runtime over the "check each number in sequence, in each base" approach that I used. i.e. if we consider up t

[gcj] Re: Disqualified!!

2009-09-12 Thread Sumudu
It's clearly stated in the terms and conditions (http:// code.google.com/codejam/terms.html): --- 13. ELIMINATION. A contestant may be prohibited from participating in this Contest if, in Google’s sole discretion, it reasonably believes that the contestant has attempted to undermine the legitimate

[gcj] Re: Why Quebec ?

2009-09-12 Thread Sumudu
I wonder if Google Translate is up to the task? On Sep 11, 11:10 pm, Jelani Nelson wrote: > http://en.wikipedia.org/wiki/Charter_of_the_French_Language#Fundament... > > The fundamental language rights of every person in Quebec are: > > "The right to have ... all enterprises doing business in Que

[gcj] Re: Round 1A | Problem C. Collecting Cards

2009-09-12 Thread bas
First you solve the bottom equation for f(1): since f(0)=0, then f(1) =1/2 * f(1)+1, and f(1)=2. After that it is easy to get f(2) from the top equation: f(2)=f (1)+1=3. In general case the number of terms in each sum and probabilities in every term depend on C, N, and k. The idea is the same tho

[gcj] Re: Multibase Happiness

2009-09-12 Thread Nzeyimana Antoine
You are right, you have to stop the loop at value when you already have that one in chain(in order to avoid useless repetitons) or just stop at a value equal to one(note that 1 has the same value in all bases: 2 ... 9) . Then you have to check if a given number(increamentally from 2 to max_int) ha

[gcj] Re: Multibase Happiness

2009-09-12 Thread Mahendra Kariya
@Antoine: can u tell me ur user name on codejam. I would like to see your code. Regards, Mahendra Kariya http://www.mahendrakariya.blogspot.com On Sat, Sep 12, 2009 at 3:00 PM, Nzeyimana Antoine wrote: > > You are right, you have to stop the loop at value when you already > have that one in chai

[gcj] Re: Multibase Happiness

2009-09-12 Thread amit jain
can any one prove that Decimal number 3 when represented in binary is happy no? On Sat, Sep 12, 2009 at 3:11 PM, Mahendra Kariya wrote: > @Antoine: can u tell me ur user name on codejam. I would like to see your > code. > Regards, > Mahendra Kariya > http://www.mahendrakariya.blogspot.com > > > On

[gcj] Re: Multibase Happiness

2009-09-12 Thread Ketan Joshi
3 in binary is 011(011) -> 0*0 + 1*1 + 1*1 -> 2 -> 10 (10) -> 1*1 + 0*0 -> 1 Hence 3 in binary is happy no. Regards, KeJO On Sat, Sep 12, 2009 at 3:55 PM, amit jain wrote: > > can any one prove that Decimal number 3 when represented in binary is happy > no? > On Sat, Sep 12, 2009 at 3:11 PM, M

[gcj] Re: Round 1A | Problem C. Collecting Cards

2009-09-12 Thread Roshan Amadoru
can you show how to get the answer when C=3, N=2.. i'm still a little confused to be honest. bas wrote: > Let f(k) be the expected number of packs we need to buy if we still > don't have k cards (or we have C-k cards). > To solve the problem we need to find f(C). Note: f(0)=0. > > In the first e

[gcj] Re: Multibase Happiness

2009-09-12 Thread Dhruva Sagar
In fact, every number other than 0, is a happy number in binary. Thanks & Regards, Dhruva Sagar. Ted Turner - "Sports is like a war without the killing." On Sat, Sep 12, 2009 at 3:55 PM, amit jain wrote: > > can any one prove that

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Xi Chen
Hi cyberfish, 7 minutes is much too long. It obviously shows that your algorithm need to be optimized. I used to try such an slow algorithm. I am not fortunate as you, my notebook is so old that if its CPU 100% occupying keeps more than 30 seconds, it must breakdown at once. So I have to figure

[gcj] Re: Multibase Happiness

2009-09-12 Thread amit jain
thanx buddy On Sat, Sep 12, 2009 at 4:05 PM, Dhruva Sagar wrote: > In fact, every number other than 0, is a happy number in binary. > > Thanks & Regards, > Dhruva Sagar. > > > Ted Turner - > "Sports is like a war without the killing."

[gcj] Re: Multibase Happiness

2009-09-12 Thread Nzeyimana Antoine
My gcj username is 'anthonzeyi' and my nickname is 'Nzeyi' . Cheers -- Nzeyimana Antoine Blog: http://nzeyi.wordpress.com Twitter: http://www.twitter.com/nzeyi -- 'Man struggles upwards, water flows downwards' : Ren wang gaochu zou, shui wang dichu liu . On 9/12/09, Mahendra Kariya wrote: > @A

[gcj] Re: how can I know if I am qualified to the round 2

2009-09-12 Thread rem
And unless you have accidentally submitted wrong source file :) On Sep 12, 12:39 pm, Cong Thanh Tran wrote: > Congrats. You are qualified because you are in top 1000 unless you > were cheating. --~--~-~--~~~---~--~~ You received this message because you are subscr

[gcj] Re: Editorial?

2009-09-12 Thread rem
There already exists "Contest Analysis" menu for all previous contests (except round 1A yet). On Sep 12, 9:52 am, Maxim Katsev wrote: > Hi All, > > Is there going to be something like an editorial for Code Jam? Or does > anyone know independent reviews of Code Jam problems? > > Max --~--~---

[gcj] Re: Round 1A | Problem C. Collecting Cards

2009-09-12 Thread 有D
in the C=3, N=2 case: f(3) = f(1) + 1;//when you are miss 3 card, you will get 2 new cards when you buy a package; f(1) = 1/3*f(1) + 2/3*f(0) + 1;//when you are missing one card, the propobility that you will not get a new card is 1/3. So, f(0)=0; f(1)=1.5; f(3) = 2.5; On Sat, Sep 12, 2009 at 6:3

[gcj] Re: how can i know what sub-round I should be in?

2009-09-12 Thread Daniel Amaral de M. Rocha
Yes. On Fri, Sep 11, 2009 at 7:21 AM, Lei Huang wrote: > Does that mean I can participate another when I'm not qualify in the first > sub-round? > > 2009/9/11 Juan Fajardo > > >> no, actually they changed the rules, so you can be in the 3 sub- >> rounds, if you qualify in one of them, then you

[gcj] 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Vexorian
Ok, let's stop to think of what would be the problem with allowing everyone -including round 1A top 1000- to compete in the remaining rounds. "Dear vexorian, As one of the top 1000 contestants in Round 1A of Google Code Jam 2009, you have unofficially advanced to Round 2! An official announcem

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Andriy G. Tereshchenko
There is no problem. If you found problem with your submissions - then report to codejam-cla...@google.com and disqualify yourself and compete in next round. But in case if you will be found to be cheated - Google and others members will figure this out and ban you from Round 2. Example: TXT fil

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Vexorian
It seems like we have the same hardware? My Core 2 Duo is a 2.93 Ghz one overclocked to 3.3 Ghz. You should have tried to use two threads/ processes, it basically makes your algorithm take 3.5 minutes ^^. Yesterday I made a whole new c++ template that uses a messed up hack to split the i/o in two

[gcj] Re: Easiest Round?

2009-09-12 Thread Vexorian
Apparently the easiest round was 1A. With only 2000~ competitors getting a positive score, and people advancing by just doing a brute force algorithm for A. On Sep 9, 6:19 pm, Brian Watkins wrote: > It looks like I've been assigned to all the rounds: 1A, 1B, and 1C. > Maybe you have, too. > >

[gcj] Re: Editorial?

2009-09-12 Thread Vexorian
hmnn about round 1A: A: Bruteforce/implementation, if you do some caching or if you do a precalculation, you can pass the large input as well. B: This was a nice problem in my opinion, unless the idea was done before in some other contest and that's the reason a lot of people thought it was obvio

[gcj] Re: Disqualified!!

2009-09-12 Thread intellectual
hmm...fair enuf...i shouldnt have done it... On Sep 12, 1:56 pm, Sumudu wrote: > It's clearly stated in the terms and conditions (http:// > code.google.com/codejam/terms.html): > --- > 13. ELIMINATION. A contestant may be prohibited from participating in > this Contest if, in Google’s sole discr

[gcj] Multibase - all bases < 10?

2009-09-12 Thread Bjoern
For round 2009 1A, problem A (Multibase Happyness): can it be inferred that all bases are <= 10? I didn't think so from the way the problem was posed, but the datasets seem to imply it. Mabye it could be inferred from the word "digits"? My initial naive algorithm failed on the large dataset. Now

[gcj] Re: Multibase - all bases < 10?

2009-09-12 Thread gislan
On Sat, 12 Sep 2009 07:03:58 -0700 (PDT), Bjoern wrote: > For round 2009 1A, problem A (Multibase Happyness): can it be inferred > that all bases are <= 10? I didn't think so from the way the problem > was posed, but the datasets seem to imply it. Mabye it could be > inferred from the word "digit

[gcj] Re: Multibase - all bases < 10?

2009-09-12 Thread Grant Kot
yeah, i didn't read this part carefully enough either so i timed out and didn't have time to change my program. i just made one with caching and it's pretty naive but it still goes in 1 minute. it speeds up nicely as everything starts getting cached at the end. --~--~-~--~~

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Nate Bauernfeind
Given that you have a 2 cores, you could've run the program twice in parallel in about 3.5 minutes. Of course, if you don't plan ahead then you're pushing your luck hoping it'll work. On Sep 12, 1:00 am, cyberfish wrote: > Just thought I should point out that, for the large input of question > A

[gcj] Re: Multibase - all bases < 10?

2009-09-12 Thread Bjoern
Ah too bad, I missed that, even reading it again now after the competition looking especially for that information. Weird :-) Thanks for the clarification! > [quote from problem statement] > Limits > > 2 ≤ all possible input bases ≤ 10 > [/quote] --~--~-~--~~~---~--~

[gcj] Flags

2009-09-12 Thread Jelani Nelson
In the qualifier round I had a Virgin Islands flag, and in round 1A I had a USA flag (in the scoreboard). Yet, I didn't change my profile. Are flags determined by the IP you compete from? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[gcj] Parallelization - allowed/how to submit code?

2009-09-12 Thread Bjoern
My non-caching solution to problem A took 82 minutes for the large data set. Naturally having a nicer algorithm would be the best option, but since I have several cores sitting around idle (2 in notebook, 4 in desktop, some old computers, too), I wonder about setting up automated parallel executio

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Chauncey Chan
It sounds a little serious. Vexorian, congrats! Andriy, Thanks for you outstanding administration. IMHO, Vexorian is a famous and active player in TopCoder. There is no doubt that he is honest enough. In other words, I know you did not talk about someone, but talk about sth. So everyone, just rel

[gcj] Re: Parallelization - allowed/how to submit code?

2009-09-12 Thread Vexorian
I think it is perfectly legal provided you include source code for the parallel system you are using ( and that you code it) Man, now you are tempting me to find a way to use my netbook's core... On Sep 12, 10:28 am, Bjoern wrote: > My non-caching solution to problem A took 82 minutes for the l

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Vexorian
TAG's an admin? It's amazing that people still submitted duplicate source files in this round. I don't think fame or activity necessarily means you are honest :) On Sep 12, 10:31 am, Chauncey Chan wrote: > It sounds a little serious. > > Vexorian, congrats! > > Andriy, Thanks for you outstandi

[gcj] Re: Flags

2009-09-12 Thread Carlos Guia
They changed the shown flag from country of residence to country of citizenship I believe. It was requested on the group by a group of people who preferred it that way. Carlos Guía On Sat, Sep 12, 2009 at 9:55 AM, Jelani Nelson wrote: > > In the qualifier round I had a Virgin Islands flag, and

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Vexorian
Cheaters are not the issue, they are after all kicked out of the whole contest, and shouldn't participate. My main issue is with people submitting the wrong source code, and not finding out until Wednesday, when they hear the news they should have gone to round 1B/C ... I know it isn't my case, b

[gcj] Re: Flags

2009-09-12 Thread Vexorian
Perhaps it would be nice to have a country to represent flag. Though that threatens to fill codejam of Antarcticans. On Sep 12, 10:41 am, Carlos Guia wrote: > They changed the shown flag from country of residence to country of > citizenship I believe. It was requested on the group by a group of

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread vladut89
these groups should have the +/- thing from topcoder On Sep 12, 7:40 am, Vexorian wrote: > Cheaters are not the issue, they are after all kicked out of the whole > contest, and shouldn't participate. > > My main issue is with people submitting the wrong source code, and not > finding out until W

[gcj] Re: Hardware speed advantage

2009-09-12 Thread cyberfish
Yeah exactly. I'm sure there are faster algorithms and slower algorithms, but the fact that I was only reqiured to find the "mediocre" algorithm and not the fast one is an advantage :). I thought about using 2 threads, too, but much too late. My code has inter-testcases optimizations, too (if the

[gcj] Re: 'You have advanced but you didn't really advance yet'

2009-09-12 Thread Andriy G. Tereshchenko
Vexorian - I'm not an admin. I've just followed rules. Everybody has 48 hours to report cheaters per rules. On Sat, Sep 12, 2009 at 5:36 PM, Vexorian wrote: > > TAG's an admin? > > It's amazing that people still submitted duplicate source files in > this round. > > I don't think fame or activi

[gcj] View contestants' source code?

2009-09-12 Thread Tri Huynh
Can anyone tell me am I able to view other contestants' source code after each contest? And how can I view it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email

[gcj] Round 1A : Problem A Large Input

2009-09-12 Thread ishani parekh
Hi, Did anyone try out coding for the Large Input set in Problem A in JAVA ?? The memo strategy used by some coders fails the Java Heap Space :( because the table to be maintained can get as large as 2000 * 10 ! Alternatively how can one decide what the upper bound of the number for a

[gcj] Re: Multibase Happiness

2009-09-12 Thread ishani parekh
@amit - 3 in binary is 11 =>(after summing squares of digits and converting back to binary) 10 (in binary) => 1 :) We are done !! regards, RosyIsh On Sat, Sep 12, 2009 at 3:55 PM, amit jain wrote: > > can any one prove that Decimal number 3 when represented in binary is happy > no? > On

[gcj] Re: Multibase Happiness

2009-09-12 Thread Ankur Sinha
On Sat, 2009-09-12 at 15:55 +0530, amit jain wrote: > > can any one prove that Decimal number 3 when represented in binary is > happy no? > 3 => 11 => 1*1 + 1*1 = 2 => 10 => 1 => happy number -- regards, Ankur --~--~-~--~~~---~--~~ You received this message

[gcj] Re: Multibase Happiness

2009-09-12 Thread NacRuno
In this question how do you define the size of the array to store previous results while looking for a pattern. During the competition i thought there is no way to be sure so i set the size of array to 1 to be on the safe side. But it took too much time (more than 8 min) and i missed the quest

[gcj] Re: Penalty Time

2009-09-12 Thread subhu hash
On Sat, Sep 12, 2009 at 10:38 AM, Carlos Guia wrote: > *4 minute penalty for each incorrect small submission **eventually solved* > > In the example B-small is never solved so it doesn't add penalty score. > > Carlos Guía > > > > On Fri, Sep 11, 2009 at 4:36 PM, Uranium.235 wrote: > >> >> Sorry i

[gcj] Re: Easiest Round?

2009-09-12 Thread Udhaya kumar
Ya.. i too agree... I regret why i was not able to attend 1A... Its the easiest... On Sat, Sep 12, 2009 at 6:24 PM, Vexorian wrote: > > Apparently the easiest round was 1A. With only 2000~ competitors > getting a positive score, and people advancing by just doing a brute > force algorithm for A.

[gcj] Re: Disqualified!!

2009-09-12 Thread Renyu Liu
I am sorry that I didn't know what do you mean clearly. Is this email for today 's ROUND 1A from codejam official? You mean that I won't take part in the ROUND 2? But I don't know why. On Sat, Sep 12, 2009 at 9:53 PM, intellectual wrote: > > hmm...fair enuf...i shouldnt have done it... > > On S

[gcj] round 1A Multi-base happiness confusion

2009-09-12 Thread Squall
Input 3 2 3 2 3 7 9 10 Output Case #1: 3 Case #2: 143 Case #3: 91 For case #3, decimal value 91 in base 9 is 111. 111->1+1+1->3 How does 3 qualified as "happy number" ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[gcj] Re: Hardware speed advantage

2009-09-12 Thread feyyaz
yes, that happened to me. my naive solution was processing 350+th case when 8 minutes is up. i have a c2duo 2 ghz On Sat, Sep 12, 2009 at 5:19 PM, Nate Bauernfeind < nate.bauernfe...@gmail.com> wrote: > > Given that you have a 2 cores, you could've run the program twice in > parallel in about 3.5

[gcj] Re: Disqualified!!

2009-09-12 Thread Renyu Liu
Why do I receive so many emails that I don't expected... I don't think it is for me. On Sat, Sep 12, 2009 at 10:17 PM, Renyu Liu wrote: > I am sorry that I didn't know what do you mean clearly. > > Is this email for today 's ROUND 1A from codejam official? > > You mean that I won't take part in

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Nate Bauernfeind
FYI for a solution that runs in less than 20 seconds you need to memoize using a simple int[11][MAX_V] kind of array. (Another FYI: hash maps have way too much overhead... Changing the hash maps in my solution to a simple array drops the run time from 23m to 18s. Doh!) Nate On Sep 12, 1:34 am,

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Nate Bauernfeind
FYI for a solution that runs in less than 20 seconds you need to memoize using a simple int[11][MAX_V] kind of array. (Another FYI: hash maps have way too much overhead... Changing the hash maps in my solution to a simple array drops the run time from 23m to 18s. Doh!) Nate On Sep 12, 1:34 am,

[gcj] Re: Easiest Round?

2009-09-12 Thread Marian
I second that. Although I performed miserably and I though I'll have to compete in the morning round after I realized that my large dataset submission was wrong (losing 30 points), I was surprised that I was qualified with only 10 points. On Sep 12, 7:54 am, Vexorian wrote: > Apparently the easi

[gcj] Ranked 1023... FML

2009-09-12 Thread aspitze...@yahoo.com
Missed it by 23 spots =. I solved A-small and then began to solve A-large. I was using eval() in python to parse the tree. On the large input it gave me a memory error! Is there anything I could have done besides parsing the tree manually or do I deserve this since I was lazy and used eval()?

[gcj] Re: View contestants' source code?

2009-09-12 Thread Anil Kishore
Ya, you can open the full scoreboard, by clicking the same in left panel, thats showing top scorers. In the full score board, you have a checkbox at top, 'solution download', you can checkin that and can download. If you want to download a specific language, you can try here http://www.go-hero.net/

[gcj] Re: Hardware speed advantage

2009-09-12 Thread cyberfish
Ah, that's probably why. I didn't even use a hash map (which would allow O(1) access). I used a set, and it's probably implemented using a tree (so O(logn) access). A hash map would have additional risk of collision, though, that would be hard to detect. But if you give it 2GB of memory or somet

[gcj] Re: round 1A Multi-base happiness confusion

2009-09-12 Thread cyberfish
3^2 = 9 or 1 in base 9. happy number. On Sep 12, 7:28 am, Squall wrote: > Input > 3 > 2 3 > 2 3 7 > 9 10 > > Output > Case #1: 3 > Case #2: 143 > Case #3: 91 > > For case #3,  decimal value 91 in base 9 is 111. > 111->1+1+1->3 > How does 3 qualified as "happy number" ? --~--~-~--~~--

[gcj] next_permutation() in java

2009-09-12 Thread Ahmed Medhat
Hello every one, any one know what is the equivalent function to next_permutation() in Java -- Kind Regards, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email

[gcj] Re: round 1A Multi-base happiness confusion

2009-09-12 Thread cyberfish
oops, I meant 10 in base 9 1^2 + 0^2 = 1 a happy number. On Sep 12, 1:28 pm, cyberfish wrote: > 3^2 = 9 > or 1 in base 9. > happy number. > > On Sep 12, 7:28 am, Squall wrote: > > > Input > > 3 > > 2 3 > > 2 3 7 > > 9 10 > > > Output > > Case #1: 3 > > Case #2: 143 > > Case #3: 91 > > > For cas

[gcj] Re: next_permutation() in java

2009-09-12 Thread Anil Kishore
There is no such function inbuilt in Java. But you can write one easily.. and save it for reference for these type of contests. You may wanna look at this, http://forums.sun.com/thread.jspa?threadID=389012&tstart=85500 , the class 'Perm' in one of the posts, implements it neatly. Cheers, - AK On

[gcj] Re: Round 1A : Problem A Large Input

2009-09-12 Thread Brian Watkins
Have you tried making it an array of bytes instead of ints? That's 75% savings. Also,you only need an array of about 1000 entries. See if you can figure out why. -Brian On Sep 12, 4:18 am, ishani parekh wrote: > Hi, > >     Did anyone try out coding for the Large Input set in Problem A in JA

[gcj] Re: Ranked 1023... FML

2009-09-12 Thread serg
you still have a chance to advance... if at least 23 person before you be disqualified ;-) > Missed it by 23 spots =. > I solved A-small and then began to solve A-large. > I was using eval() in python to parse the tree. > On the large input it gave me a memory error! > Is there anything I c

[gcj] Re: round 1A Multi-base happiness confusion

2009-09-12 Thread brilliantnut
111 -> 1 + 1 + 1 -> 3 -> 3*3 -> 10 (9 in base 9) -> 1 + 0 -> 1 happy! On Sep 12, 7:28 pm, Squall wrote: > Input > 3 > 2 3 > 2 3 7 > 9 10 > > Output > Case #1: 3 > Case #2: 143 > Case #3: 91 > > For case #3,  decimal value 91 in base 9 is 111. > 111->1+1+1->3 > How does 3 qualified as "happy numb

[gcj] Re: View contestants' source code?

2009-09-12 Thread brilliantnut
In the scoreboard, there is a check box: "Solution Download"... check it, and all the green check marks change to solution download links. On Sep 12, 11:12 am, Tri Huynh wrote: > Can anyone tell me am I able to view other contestants' source code > after each contest? And how can I view it? --~

[gcj] Re: Round 1A : Problem A Large Input

2009-09-12 Thread Bartholomew Furrow
java drives me nuts for that reason -- old versions, at least, would limit the amount of memory you could use to some constant. You have to run with java -Xmx10 to give it 10^9 bytes of memory; otherwise it defaults to something absurdly small, like 32 MB. Of course, my working knowledge

[gcj] Round 1B The next Number

2009-09-12 Thread sep
The number is 800 The next number is 8000 or 1008? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-code@googlegroups.com To unsubscribe from th

[gcj] Re: Disqualified!!

2009-09-12 Thread DavidJSpooner
Because when you joined this group you probably selected to receive copies of all postings in this group sent to your inbox On Sep 12, 3:31 pm, Renyu Liu wrote: > Why do I receive so many emails that I don't expected... > > I don't think it is for me. > > On Sat, Sep 12, 2009 at 10:17 PM, Renyu

[gcj] Re: Round 1B The next Number

2009-09-12 Thread David M.
8000.Only can use an eight and all zeros you want... 2009/9/12 sep > > The number is 800 > > The next number is 8000 or 1008? > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To p

[gcj] Re: Ranked 1023... FML

2009-09-12 Thread Vexorian
Or , he could do round 1C. On Sep 12, 5:38 pm, serg wrote: > you still have a chance to advance... > if at least 23 person before you be disqualified ;-) > > > Missed it by 23 spots =. > > I solved A-small and then began to solve A-large. > > I was using eval() in python to parse the tr

[gcj] Re: Ranked 1023... FML

2009-09-12 Thread aspitze...@yahoo.com
Yes, although it's going to be hard it starts 5 am where I live... On Sep 12, 6:59 pm, Vexorian wrote: > Or , he could do round 1C. > > On Sep 12, 5:38 pm, serg wrote: > > > > > you still have a chance to advance... > > if at least 23 person before you be disqualified ;-) > > > > Missed it

[gcj] Re: next_permutation() in java

2009-09-12 Thread Grant Kot
there's a language that has that? anyway, wikipedia has sums everything up nicely in four easy steps: > > The following algorithm generates the next permutation lexicographically > after a given permutation. It changes the given permutation in-place. > >1. Find the highest index *i* such that s

[gcj] Re: next_permutation() in java

2009-09-12 Thread Adam Czachorowski
Dnia niedziela 13 wrzesień 2009 o 01:09:27 Grant Kot napisał(a): > there's a language that has that? anyway, wikipedia has sums everything up C++ STL has next_permutation() in Check out http://www.sgi.com/tech/stl/next_permutation.html Looks like C++ is still best choice for programming competi

[gcj] Re: Parallelization - allowed/how to submit code?

2009-09-12 Thread Bartholomew Furrow
> > I think it is perfectly legal provided you include source code for the > parallel system you are using ( and that you code it) > > Man, now you are tempting me to find a way to use my netbook's core... Yeah, there's no rule against using multiple machines; just make sure you submit code such

[gcj] Re: next_permutation() in java

2009-09-12 Thread Sumudu
If you have next_permutation, an easy way to handle adding the zero is to put it in the leading position, run next_permutation, and then check if the zero is still leading. If so, drop it, otherwise, output. On Sep 12, 5:09 pm, Grant Kot wrote: > there's a language that has that? anyway, wikipe

[gcj] Re: next_permutation() in java

2009-09-12 Thread Vexorian
But hash tables are still a little messed up... On Sep 12, 7:13 pm, Adam Czachorowski wrote: > Dnia niedziela 13 wrzesień 2009 o 01:09:27 Grant Kot napisał(a): > > > there's a language that has that? anyway, wikipedia has sums everything up > > C++ STL has next_permutation() in > Check outhttp:

[gcj] Re: next_permutation() in java

2009-09-12 Thread Grant Kot
Cool, Sumudu, with your suggestion I was able to shorten my code by half! So it's pretty short even without next_permutation(). But that basically means that if someone has next permutation they could solve it with almost no code at all. StreamReader reader = new StreamReader("input.in"); StreamWri

[gcj] can i sacrifice to learn c++-stl for java?

2009-09-12 Thread vicky
can i sacrifice to learn c++-stl for java? IS IT or are there very large number of advantages of using c++ stl that i can't ignore it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to

[gcj] Re: can i sacrifice to learn c++-stl for java?

2009-09-12 Thread Vexorian
This sounds like a false dichotomy. You can learn both. The STL is very nice for contents, though Java has its own good things, I guess. On Sep 12, 9:18 pm, vicky wrote: > can i sacrifice to learn c++-stl for java? > IS IT or are there very large number of advantages of using c++ stl > that i

[gcj] Re: can i sacrifice to learn c++-stl for java?

2009-09-12 Thread Carlos Guia
I recommend getting an overall knowledge of both so you know what can be done in each of them. Then use the language you are most comfortable with by default. But if for a particular problem, you believe the other language has a big enough advantage for you to use your non so favorite language, th

[gcj] Re: can i sacrifice to learn c++-stl for java?

2009-09-12 Thread vicky
ok if i now decide to learn c++ stl now , then what will be the best tutorialwhich shall be both concise and comprehensive On Sep 13, 6:39 am, Carlos Guia wrote: > I recommend getting an overall knowledge of both so you know what can be > done in each of them. > Then use the language you are mos

[gcj] Re: Multibase Happiness

2009-09-12 Thread Satyajit Malugu
I've put all the results in Java Set and if its a repeat. Then I breaked. But this does not a good strategy as I got bugs for large input On Sat, Sep 12, 2009 at 6:00 AM, NacRuno wrote: > > In this question how do you define the size of the array to store > previous results while looking for a

[gcj] Re: can i sacrifice to learn c++-stl for java?

2009-09-12 Thread Carlos Guia
Well I don't really have an answer for the best tutorial, this link is to the sgi reference, which is not tutorial-like but I believe is one the most useful resources. Check the "how to use this site" and the "table of contents" and, with time and practice, you should be able to learn most of the a

[gcj] Re: next_permutation() in java

2009-09-12 Thread Faiz Bashir
Could u provide the Wikipedia link? On Sun, Sep 13, 2009 at 7:09 AM, Grant Kot wrote: > there's a language that has that? anyway, wikipedia has sums everything up > nicely in four easy steps: >> >> The following algorithm generates the next permutation lexicographically >> after a given permutat

[gcj] Re: Round 1A | Problem C. Collecting Cards

2009-09-12 Thread Roshan Amadoru
Neat. That solved my problem. Thanks bas & 有D . On Sat, Sep 12, 2009 at 5:39 PM, 有D wrote: > in the C=3, N=2 case: > f(3) = f(1) + 1;//when you are miss 3 card, you will get 2 new cards when > you buy a package; > f(1) = 1/3*f(1) + 2/3*f(0) + 1;//when you are missing one card, the > propobility

[gcj] Re: next_permutation() in java

2009-09-12 Thread Ahmed Medhat
http://en.wikipedia.org/wiki/Permutation 2009/9/13 Faiz Bashir > Could u provide the Wikipedia link? > > > On Sun, Sep 13, 2009 at 7:09 AM, Grant Kot wrote: > >> there's a language that has that? anyway, wikipedia has sums everything up >> nicely in four easy steps: >>> >>> The following algori

[gcj] Re: Round 1B The next Number

2009-09-12 Thread Lev
check this out: http://www.cppreference.com/wiki/stl/algorithm/next_permutation most solutions used this trick, without having to implement it On Sep 12, 6:00 pm, "David M." wrote: > 8000.Only can use an eight and all zeros you want... > > 2009/9/12 sep > > > > > The number is 800 > > > The ne

[gcj] Re: Ranked 1023... FML

2009-09-12 Thread Lev
how do you parse the tree? You can solve this problem without having to build explicit tree data structure. You can just tokenize the tree string, and then have a simple recursive method that computes probability for each animal. On Sep 12, 2:34 pm, "aspitze...@yahoo.com" wrote: > Missed it by

[gcj] Round 1A 2009--Multi-base happiness

2009-09-12 Thread David Loo
every time,,replace it by the sum of the squares of its digits after the digits are changed by the base? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to go

[gcj] Re: Hardware speed advantage

2009-09-12 Thread Dennis Cheung
Yes, it does matter. I tired to implement the isHappy() in Java with HashMap. It just fail because of OutOfMemoryError(with -Xmx1024MB). Then after, I checked the source from the top guys. The algorithm is exactly the same, but he use C++. I don't think language is a matter, so I rewrite my pro

[gcj] Re: Round 1B The next Number

2009-09-12 Thread Rakesh
Hi, Can anyone help me to find the bug in this code. The output looks correct to me. So, I am sure I am missing something in understanding the problem. { String number = input.nextLine(); char digits[] = new char[number.length()]; for(int i=0; i=0; i--) { if

[gcj] Re: Any good editors for Ruby and specifically Ruby on Rails

2009-09-12 Thread Arun Kumar
I'd say Emacs is the best for RoR and Ruby. http://peepcode.com/products/meet-emacs On Tue, Sep 8, 2009 at 12:40 AM, Satyajit Malugu wrote: > Even debugging? The reason GUI IDE's are famous is for their debuggers > otherwise command line VIM is simple and cute > > On Mon, Sep 7, 2009 at 1:41 PM,

[gcj] Re: Easiest Round?

2009-09-12 Thread Асямов Игорь
I agree about that Round 1A was easiest to qualified, but not in problems,it was harder than in 1B Round. 2009/9/12 Marian > > I second that. > Although I performed miserably and I though I'll have to compete in > the morning round after I realized that my large dataset submission > was wrong (l