
Ask HN: How can someone solve a code jam competition problem in 1.4 minutes? - eranation
I am doing my first code jam, I spent an hour or so on the first problem, and submitted (after 1 wrong attempt), and was pretty proud of myself. Then I looked at the first ranked person (some Standford student with a track record of competition)<p>He &#x2F; She did it in 1.4 minutes.<p>Just reading the description of the question, writing the code and compiling will take me more than that.<p>Is that person simply a genius? My ego is shattered beyond recognition. (Instead of being happy that I solved my first competition problem...)<p>p.s. the problems this year seem way harder than the qualification rounds samples they have there. I never felt more stupid in my life. I recommend anyone who has a steady programming job, to stay away from these competitions, even if you are considered the smartest coder at work. You will feel stupid and incompetent, (and humbled to the ground).<p>I wish I could see a video of one of them as they code.<p>Could it be that questions in competitions simply repeat themselves and they just pulled some similar code and just modified it?<p>what are the &quot;secrets&quot; of programming competitions? Is it like chess? if you practice enough past competitions you are pretty much ready to anything they&#x27;ll throw at you?<p>Or are these people really, really smart? (Or I&#x27;m really really stupid? :))<p>Ego shattered to the floor, considering switching careers (and I&#x27;m considered a pretty good developer...)<p>Very humbling experience, perhaps too humbling.
======
tuscarok
There is a set list of topics that come up every year in these programming
competitions, including:

* dynamic programming

* tries

* depth/breadth first traversal of a graph

* combinatorics

* graph colouring

* prime generation techniques

These topics are almost guaranteed to crop up every year, and the people who
do well in these programming competitions learn all these techniques off by
heart. They have their own library and macros which do all this stuff, and
when they read the question they instantly see which technique they need to
use and boom they're done. You have to remember that these people have been
practising this stuff from a very early age, and that in many cases, spending
hours and hours becoming good at this is their only way out of a crappy life
(Eastern Europeans). However, being good at competitive programming has very
little correlation with being a good software engineer (I think there is some
analysis done by the likes of Google or Microsoft which proves this, I will
try to find the link later).

~~~
malpiatko
However, University of Warsaw is one of the best unis in these kind of
competitions and also the biggest source of graduate employees for Google,
etc. Therefore, even though maybe doesn't prove you are a perfect programmer,
it proves you are smart and capable of learning.

~~~
tuscarok
Yes, but you can be an excellent software engineer without being good at
competitive programming.

------
tienthanh8490
I think you are talking about xiaowuc1, who is on top of scoreboard and having
solved first problem's small data input in 1.4 mins.

FYI, he gave a Quora answer about his view on Competitive Programming
[http://qr.ae/dx4m6](http://qr.ae/dx4m6)

"Especially in the United States, there's little glory to be had in doing
programming contests. I've invested thousands of hours into them, solving
problem after problem, writing line of code after line of code, for what? My
peers, meanwhile, are off doing amazing things: some are doing ground-breaking
research with professors, others are finding new passions that they only could
have discovered at Stanford... the list goes on. I'll be retiring from
competitive programming after World Finals this year, in part because I want
to live a more normal life."

That's in 2013, and he is still participating in this year's contest, so I
guess he is still in love with it :p

Anyway, I did my first code jam last year and also got my ego shattered when
looking at the scoreboard. I passed the online qualification round though, but
decided to stop since I think it's nonsense trying to complete with thousands
of competitive programmers to get to top 1000 when I never practiced as much
as them. I used to be like them when I did math contests in high school, so I
know what it feels. It's not about your IQ or anything like that, it's just
about practice, practice, practice.

It's up to you to decide whether competitive programming is good for your
career. For me I'm still doing it occasionally for fun (not really competitive
since I just pick problems in areas that I find interesting and do it alone),
but since I'm already spend 8 hours a day at work and have a bunch of
unfinished side projects in hand and a long list of other things I want to
learn, I don't think it's worth spending thousands hours of my time to compete
in such contests.

You can also refer to this
[https://news.ycombinator.com/item?id=9337863](https://news.ycombinator.com/item?id=9337863)
. I think the situation is similar, as doing competitive programming means
putting yourself in relative comparison with others. It's just a double edged
sword =)

------
eatitraw
> Just reading the description of the question, writing the code and compiling
> will take me more than that.

I am pretty sure he skipped compiling! I am being serious here.

Honestly, I am not sure why you are surprised. Competitive programming is
different from regular programming, and like every other field it require
years of training and experience to become good.

After a while you just learn to recognize patterns and common topics.

I think your comparison to chess is a good one. Both chess and competitive
programming require years of deliberate practice to become good.

Source: done both. Though I was only somewhat good at chess, I was fairly
successful at programming contests a few years ago(not this guy's level good
though).

> Is that person simply a genius? My ego is shattered beyond recognition.
> (Instead of being happy that I solved my first competition problem...)

Don't feel bad about yourself! Imagine a Java programmer writing their first
haskell program and being surprised at how quickly haskell programmers are
able to write code in haskell. That's how your post looks to me.

------
codenut
Yes, its possible to solve the first problem in 1.4 minutes. Serious
competitive programmers(like the guy you mentioned) has a template prepared to
solve the problems so that they can parse the input easily and besides the
logic for the first problem is very simple.

------
bjourne
Practice. I play guitar and I can now impress my mom and some friends, after
years of practicing hard. But I'll never play as well as Slash or Tom Morello
or even as good as the kids that sit and jam in guitar shops. It doesn't
bother me (ok the kids does a little because they are clearly showing off). My
point is that it is a good thing that many people are much better than you
because it means there is so much left to learn in the field you are studying.

Btw, is it this competition?
[https://code.google.com/codejam](https://code.google.com/codejam)

------
Klockan
To get that fast you need to write around 1 line of code per 3 seconds with
zero bugs. It might seem impossible but if you train with it as a goal you
will eventually reach it. It is true though that people use libraries and
such, but no library would save any time on this problem and prebuilding the
print "Case X:" wouldn't save much more than a few seconds.

------
aquelarre
I was going to give a try to your problem to solve it 1.3 minutes, but you
don't pose the problem, so no way to know if it is possible or not.

~~~
Klockan
You can view it here now that the contest is over:

[http://code.google.com/codejam/contest/6224486/dashboard](http://code.google.com/codejam/contest/6224486/dashboard)

