[gcj] Re: Question about Watersheds

2009-09-05 Thread yys159257
This prob deal with flows ,I think it means make every flow is shortest, so every time chioce the lowest position as next position ,and we consider every flow as a word. 在2009-09-05?11:53:00,Cong?Thanh?Tran?congth...@gmail.com?写道: Look?at?the?sample?in?the?problem: 9?6?3 5?9?6 3?5?9

[gcj] in C++ how to format the output for int type

2009-09-05 Thread MagicLi
Like in qualification round for Problem C, we have to show instead of 0, I did it in a ugly way, change int to string type and then add '0' if num1000, add '00' if num100, add '000' if num10; can anyone have a better way? BTW, do not use C-style output like fprintf(ofp, Case #%d: %04d\n, t,

[gcj] Re: Acknowledgment of qualifying Qualification round

2009-09-05 Thread Hawston LLH
maybe they will check the sourcecode pairwisely to determine any cheating :) On Sat, Sep 5, 2009 at 1:26 PM, Carlos Guia zyx3d...@gmail.com wrote: I guess anything that is against the rules is considered cheating Carlos Guía On Fri, Sep 4, 2009 at 11:14 PM, Dhruva Sagar

[gcj] Re: a simple c++ question

2009-09-05 Thread Ralph Furmaniak
Technically it should eat as much whitespace as it can (including spaces on the next line). As I recall, space and newline are not differentiated and putting either into the scanf format simply signifies ignore whitespace On Sep 4, 2009, at 10:46 PM, Carlos Guia zyx3d...@gmail.com wrote:

[gcj] Re: a simple c++ question

2009-09-05 Thread 周 游弋
IMHO, getline in C++ is not that clean. Please have a look at this: #include iostream using namespace std; int main() { int i; string s; cin i; getline(cin, s); cout i endl; cout s endl; return 0; } With this input: 1 Hello What output will you expect?

[gcj] Re: a simple c++ question

2009-09-05 Thread Hawston LLH
getline() is delimited by '\n', so there is no ambiguos. 2009/9/5 周 游弋 zhou.yo...@gmail.com IMHO, getline in C++ is not that clean. Please have a look at this: #include iostream using namespace std; int main() { int i; string s; cin i; getline(cin, s); cout

[gcj] Re: Acknowledgment of qualifying Qualification round

2009-09-05 Thread Dhruva Sagar
lol :D Thanks Regards, Dhruva Sagar. Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html - If God had wanted man to play soccer, he wouldn't have given us arms. On Sat, Sep 5, 2009 at 11:56 AM, Hawston LLH haws...@gmail.com wrote: maybe they will check the sourcecode

[gcj] Re: Water Shed

2009-09-05 Thread Tareq Alkhaldi
There's a book called Programming Challenges, it should be a nice place to start from. You can find it's PDF free somewhere online, that's where Google comes to serve =) On Sep 5, 9:59 am, CodeJunky pure.vintage@gmail.com wrote: thanks buddy!! im actually new in coding arena

[gcj] Re: Water Shed

2009-09-05 Thread Hawston LLH
maybe you can read more on dynamic programming first, it is about how to divide the problem into smaller piece of elements recursively. simple example - write a factorial function N! int factorial(int N) { //bounday or stopping condition if (N=1) return 1; //here, try to process 1 step

[gcj] Re: Problem C Welcome to Code Jam

2009-09-05 Thread Matteo Landi
Personally speaking i did %1000 instead %1! And this kind of error has come out only in the large input! ;) On Fri, Sep 4, 2009 at 10:59 PM, Beybaltc...@gmail.com wrote: Hi I noticed that there are a large number of people who go the small input correct for prob C but not the large

[gcj] Re: in C++ how to format the output for int type

2009-09-05 Thread krzych
IO manipulators are your friends (include iomanip): cout Case # i+1 : setfill('0') setw(4) res endl; On Sep 5, 8:24 am, MagicLi musicl...@gmail.com wrote: Like in qualification round for Problem C, we have to show instead of 0, I did it in a ugly way, change int to string type

[gcj] Re: Can anyone tell me why there are three sub round in the round1

2009-09-05 Thread Luke Pebody
Also Group C get to practice on the problems from the 1st subround, and losers from B get to practice on the problems from the 2nd subround. On Sat, Sep 5, 2009 at 6:50 AM, Hawston LLHhaws...@gmail.com wrote: Is there any different about the choice of picking which two subrounds? I think it

[gcj] Re: perl solutions

2009-09-05 Thread Luke Pebody
If you are checking each word against a regex that you make from the input, you can make a big speed up by surrounding the regex with ^ and $. Here is my program in AWK: (NR == 1){numWords = $2} ((NR = 2) (NR = (1+numWords))){words[$1] = 1} (NR (1+numWords)){ gsub(/\(/,[); gsub(/\)/,]); $1=^

[gcj] Re: Fwd: Competency levels

2009-09-05 Thread Ostap
In the competition like Google Code Jam the language is just a tool to implement your algorithms and ideas of solving the problem. So you should select the tool you are most comfortable with. The main job for the participant is to come up with a correct and efficient algorithm for solving the

[gcj] Re: Fwd: Competency levels

2009-09-05 Thread rahul chhabra
I am also new to this programming contest and after Qualification round, I strongly believe that people grow the most when they enter the Zone of the Unknown. So, its the best opportunity for coders like me, who are used to live in small coding world to get real exposure... Hope to be a good

[gcj] Re: how is everyone going on the qualification round

2009-09-05 Thread Miguel Oliveira
Jason, I did the same as you but using a bitmask instead of an aditional [26] array. But the speedup of about a factor of 26 wasn't an issue here. Ken, I have several years of experience in C++ and so I'm not thinking in switching. I also have a few years of experience in Java but never used the

[gcj] Re: a simple c++ question

2009-09-05 Thread vexorian
I expect 1 followed by an empty line. It may be tricky the first time, but once you understand how it works you know about it, it is not really ambiguous. On Sep 5, 2:45 am, 周 游弋 zhou.yo...@gmail.com wrote: IMHO, getline in C++ is not that clean. Please have a look at this: #include iostream

[gcj] Re: how is everyone going on the qualification round

2009-09-05 Thread vexorian
I completely ignored the existence of regexes when solving it. It just seemed logical to just use bitmasks. I was surprised to see so many people using regexes later. A good C/C++ can use sscanf to the same effect as the regexes solutions. Though sscanf is a lost art that not a lot of people

[gcj] Re: Shall I knw when wll next google code jam be conducted?

2009-09-05 Thread senthil
Thank you carlos for the useful site.. I will sure register in topcoder site, On Sep 5, 11:07 am, Carlos Guia zyx3d...@gmail.com wrote: I'm sorry to hear that, but keep track of the contest and use the problems to practice. I guess the next Google Code Jam at the very least is about in a

[gcj] Re: in C++ how to format the output for int type

2009-09-05 Thread MagicLi
That is very good. Thanks a lot! I appreciate! On Sep 5, 4:14 am, krzych krzychoo...@gmail.com wrote: IO manipulators are your friends (include iomanip): cout Case # i+1 : setfill('0') setw(4) res endl; On Sep 5, 8:24 am, MagicLi musicl...@gmail.com wrote: Like in

[gcj] Re: in C++ how to format the output for int type

2009-09-05 Thread gustavo pacianotto gouveia
you can also use printf(Case #%d: %04d\n,i++,value); maybe you like to use the functions from C++, but printf is faster than cout.. and, in this case, is a little bit easier to code. 2009/9/5 MagicLi musicl...@gmail.com That is very good. Thanks a lot! I appreciate! On Sep 5, 4:14 am,

[gcj] Re: in C++ how to format the output for int type

2009-09-05 Thread romanr
gustavo pacianotto gouveia wrote: you can also use printf(Case #%d: %04d\n,i++,value); maybe you like to use the functions from C++, but printf is faster than cout.. and, in this case, is a little bit easier to code. printf is faster but no safer every IO is slow by definition, so no reason

[gcj] Solution List in http://www.go-hero.net/jam/09/solutions/0/1/Perl not complete?

2009-09-05 Thread vgbhat
I looked into the http://www.go-hero.net/jam/09/solutions/0/1/Perl site to list all the solutions for Alien Language, solved by Perl. But, it only lists 100 coders. Does it list first 100, or efficient codes, or any error in this site? I solved the first problem in perl, and got 33, and my rank

[gcj] How many contestants in each subround?

2009-09-05 Thread Ishan Chattopadhyaya
How can I know how many contestants there will be in each sub-round? --~--~-~--~~~---~--~~ 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

[gcj] Re: Any Ruby programmers on Windows?

2009-09-05 Thread Selasie Agbavor
I am a Ruby coder myself.self taught.you can also learn from www.rubylearning.com On Wed, Sep 2, 2009 at 2:20 PM, Rishabh Sonthalia rishabh...@gmail.comwrote: Ruby is it something that u all learnt on ur own, or was it thaught 2 u? if thaught, where can we learn it from?

[gcj] Re: Intuitive explanation of an efficient solution for problem C Welcome to Code Jam

2009-09-05 Thread Bjoern
Thanks! Just wondering, how did you arrive at the solution? In hindsight it seems obvious, but I must admit I did not think of it during the competition :-) Certainly I don't see a way to think of it in 10 minutes or so. So I wonder if similar algorithms have come up in other programming

[gcj] Re: Water Shed

2009-09-05 Thread itissid
Dude that factorial example is not DP!!! On Sep 5, 12:43 am, Hawston LLH haws...@gmail.com wrote: maybe you can read more on dynamic programming first, it is about how to divide the problem into smaller piece of elements recursively. simple example - write a factorial function N! int

[gcj] Re: How To Know

2009-09-05 Thread Ishan Chattopadhyaya
no, your opinion is wrong. they picked whoever got 33 or more and didn't cheat. On Sep 4, 7:13 pm, Kishore Reddy enigma2006.kish...@gmail.com wrote: Its obvious that with the same 33 points I got 6000+ rank and some guy got 7830+ rank means they considered the time, number of penalties, etc.,

[gcj] waiting for final intimation of 1st round

2009-09-05 Thread gun
Could anyone please tell, when we will get final mail of clearing the qualifying round.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups google-codejam group. To post to this group, send email to

[gcj] Re: Problem C Welcome to Code Jam

2009-09-05 Thread Rick Xu
I used fgets of C, but I forgot to trim the newline(\n) of each input line It is so tricky that my output for small input is correct On Fri, Sep 4, 2009 at 4:59 PM, Bey baltc...@gmail.com wrote: Hi I noticed that there are a large number of people who go the small input correct for

[gcj] OK to blog about solution approaches to the gcj problems?

2009-09-05 Thread Bjoern
This was my first programming competition and I am only learning some of the algorithms by and by. I've looked at some of the submitted solutions and then tried to figure out the logic behind them. Since the solutions from the top contestants usually don't explain much, I wonder if it would be

[gcj] Re: Round 1a question: Minimum Scalar Product

2009-09-05 Thread dionysus
actually you can download the correct source code of other contestants from the scoreboard. After running the programm, it's easy get the correct output. On 9月5日, 上午5时18分, manish manish...@gmail.com wrote: Can anyone give me the correct output of this question for large test cases. Thanks in

[gcj] Re: waiting for final intimation of 1st round

2009-09-05 Thread Bartholomew Furrow
You advanced if you got at least 33 points and didn't cheat. We'll send the official announcement, as well as an email about round assignments, some time in the next few days. On Sat, Sep 5, 2009 at 5:33 AM, gun gunjan.m...@gmail.com wrote: Could anyone please tell, when we will get final

[gcj] Re: Intuitive explanation of an efficient solution for problem C Welcome to Code Jam

2009-09-05 Thread Carlos Guia
Search for Dynamic Programming (DP) and his close cousin memoization (not a typo). A very high percent of programming contests have at least one DP problem, so getting familiar with it will certainly help you improve in this type of competitions. You can check the tutorials at

[gcj] Re: a simple c++ question

2009-09-05 Thread Sumudu
I prefer %[^\n]s%*c to eat the newline (* signifies that there is no variable to capture the character into). On Sep 4, 11:46 pm, Carlos Guia zyx3d...@gmail.com wrote: I'm not a 100% sure, so who likes this will have to test it before a real contest, but I think you can eat the '\n' like this:

[gcj] Re: Water Shed

2009-09-05 Thread Luke Pebody
I thought that. On Sat, Sep 5, 2009 at 5:13 PM, itissiditis...@gmail.com wrote: Dude that factorial example is not DP!!! On Sep 5, 12:43 am, Hawston LLH haws...@gmail.com wrote: maybe you can read more on dynamic programming first, it is about how to divide the problem into smaller piece

[gcj] Re: Water Shed

2009-09-05 Thread Bartholomew Furrow
Why you said that? Recursion is part of dynamic programming (top down approach), am i wrong? This is actually a matter of definition. I'd argue that a simple recursion like that doesn't have any of the interesting properties of dynamic programming, but I suppose you could call it DP if you

[gcj] Re: Solution check

2009-09-05 Thread Luke Pebody
Under what name did you submit your code? On Sat, Sep 5, 2009 at 5:22 AM, togguillaume.all...@gmail.com wrote: Hi coders, I am a bit surprised - I got the right answer to A-large while my answer to A-small is considered wrong. I am a bit puzzled since I used the same code (I checked) ...

[gcj] Re: can the language used by the contestant be displayed in the scoreboard?

2009-09-05 Thread Luke Pebody
Java is the 2nd most popular language. There are candidates who find it much harder to find peers who used the same language. On Sat, Sep 5, 2009 at 7:33 PM, Bartholomew Furrowfur...@gmail.com wrote: http://www.go-hero.net/jam/09/solutions http://www.go-hero.net/jam/09/regions The latter

[gcj] Re: How To Know

2009-09-05 Thread Bartholomew Furrow
ACRush. did. Not ACRush, ACRush.. On Sat, Sep 5, 2009 at 2:48 PM, Luke Pebody luke.peb...@gmail.com wrote: Did anyone answer more than one large problem set but no small problem sets? On Sat, Sep 5, 2009 at 7:39 PM, Bartholomew Furrowfur...@gmail.com wrote: Once again: if you have at

[gcj] Algorithm book

2009-09-05 Thread SB
Kudos to these guys who prepared these qualification round problem. Credits Problem A. Alien Language Written by Junbin Teng. Prepared by Marius Andrei. Problem B. Watersheds Written by Andrew Gove. Prepared by Xiaomin Chen and Igor Naverniouk. Problem C. Welcome to Code Jam Written by Xiaomin

[gcj] Re: Algorithm book

2009-09-05 Thread Satyajit Malugu
CLRS is the definitive book but its prettty pretty big and intimidating. I have it before me and dozing off ;) On Sat, Sep 5, 2009 at 3:42 PM, SB santosh.bhus...@gmail.com wrote: Kudos to these guys who prepared these qualification round problem. Credits Problem A. Alien Language Written

[gcj] Re: Water Shed

2009-09-05 Thread Anshuman Anshu - CSE - 2K7
@rahul go for programming challenges..by skienna(sponger verlag) On Sep 6, 12:26 am, Matteo Landi landima...@gmail.com wrote: Why you said that? Recursion is part of dynamic programming (top down approach), am i wrong? On Sat, Sep 5, 2009 at 6:13 PM, itissiditis...@gmail.com wrote: Dude

[gcj] hi

2009-09-05 Thread sap30
hi i am very new to coding first of all i want to know the solution of the first problem how you people decide the size array you take initially means some take [5000] [17],and kindly explain me in detail and second that what should i do to improve my coding skill means so that i can solve