
Visual explanation of the last Google Codejam 2017 question - asrp
https://asrp.github.io/blog/gcj_qual2017
======
kgwgk
Their analysis in terms of chess pieces also helps:
[https://code.google.com/codejam/contest/3264486/dashboard#s=...](https://code.google.com/codejam/contest/3264486/dashboard#s=a&a=3)

~~~
mlgh
Thank you! After reading blog-post I had zero understanding of what the
problem is about and how they solve it. Tried to read again - no luck. Then I
opened codejam link and saw that it's basically about placing maximum amount
of bishops using maximum matching. (Other parts of problem are trivial)

That's really sad that this pattern of bad explanations is so frequent in the
internet.

------
wslh
Could this be easily solved with the Z3 theorem prover? Is Z3 an acceptable
programming language for this code jam.

~~~
njs12345
Looks like you would be allowed to use it:
[https://code.google.com/codejam/terms](https://code.google.com/codejam/terms)

'You may use any programming language to solve a Code Jam problem. However,
for any round after the qualification round, the compiler, interpreter,
libraries, and external services you use must be available such that anyone
else can use it for free without a time limitation and without violating any
rights of any person or entity'

------
master_yoda_1
I was also confused about algorithmic skill and software engineering skills.
But I got clarification after working in industry for a while.

1) Most of the software engineering work is product development, just wrapping
already existing algorithm and optimized computer program into apis and test
and maintain it.

2) There are very few software engineering work involving writing algorithm
and optimized computer program.

One example, everyone here might have just used mysql database. But if you
look into the code, you might see there are complex data structure, and
algorithm are being used.

[https://github.com/mysql/mysql-server](https://github.com/mysql/mysql-server)

Its a good thing to solve these kind of algorithmic problems.

------
Achshar
The more I scroll, the stupider I feel. Ugh.

~~~
asrp
This wasn't my intention. I hope the feeling subsides!

I did try to keep it short although some parts still (fortunately) shows how
to come to those conclusion. That might give it the impression of being smart
but the presentation is definitely selected among many idea and rearranged.

------
hartator
I wonder if there is a real cause and effect relationship between being good
at this kind of games and being a good coder. I suspect not.

~~~
yodsanklai
I wonder too. I think it's like asking whether a math olympiad champion would
make a great engineer. Certainly they have a lot of potential because they
show extraordinary abilities, but there is much more to being a good coder
than _just_ being able to solve very short and extremely specific problems.

I've been playing these games for a couple of years (initially, for interviews
preparation), and it's been very instructive. The competition format makes it
convenient and addictive. There's no doubt that I improved a lot on
algorithms, data structures and on "small scale" coding. While this is useful,
it is quite different than what you do when working on real projects.

~~~
nindalf
When I was preparing for interviews I found that the skill that overlapped
between interview puzzles and everyday work was the "head interpreter" as I
call it. Typically you end up relying on the IDE and the compiler telling you
if what you're writing makes sense or not. Static analysis by the IDE would
only tell you if you've made a syntax error, you would need to run a test to
tell if what you've written makes logical sense too.

So there's a couple of advantages if you can execute code in your head line by
line while storing state as well. You can be slightly faster and more correct
while coding yourself and while reviewing the code that others have written.
Typically in the latter case you don't have the benefit of the compiler or
running tests.

In my anecdotal experience I found an improvement in my "head interpreter"
after practising interview questions for a while because typically you're not
allowed to execute your code. I can't say if any of the algorithms I learnt
and practised helped, but this, in my opinion, made me slightly better at my
day job.

------
dorianm
Now I just need to understand flow networks:
[https://en.m.wikipedia.org/wiki/Flow_network](https://en.m.wikipedia.org/wiki/Flow_network)

~~~
allenz
I think college lectures are still the best resource for learning problem
solving. You might want to work through [https://youtu.be/xWTc8xuHX00?list=PL-
XXv-cvA_iDbtIylJDpPPJfa...](https://youtu.be/xWTc8xuHX00?list=PL-XXv-
cvA_iDbtIylJDpPPJfaFweeaR-3&t=1111)

~~~
dorianm
Thanks, I'm gonna see what can be applied to my own problems

------
stevebmark
Is this trolling? I don't understand most of it and it ends in the middle of
the unfollowable explanation.

~~~
anonymoushn
After you reduce it to maximum bipartite matching you just use whatever stock
algorithm for bipartite matching you want.

Another comment links to the official writeup. The official writeup says that
you can think about it as the "rook subproblem" and the "bishop subproblem"
separately. This is the easiest way to think about it imo.

------
conistonwater
It's not really a maximum matching problem if a greedy algorithm works.

~~~
asrp
Which greedy algorithm do you mean?

I meant that bipartite matching was enough for getting the answer, not that
the two are equivalent.

~~~
anonymoushn
There's a greedy algorithm explained at the bottom of this post:
[https://code.google.com/codejam/contest/3264486/dashboard#s=...](https://code.google.com/codejam/contest/3264486/dashboard#s=a&a=3)

------
fidz
How did you make the animation?

~~~
asrp
I, um, recorded my screen while a loop was running to change values. Its a bit
of a hack.

~~~
anonymoushn
What are you using to render the animation then?

~~~
asrp
I think Inkscape uses Cairo for rendering. So eventually Cairo.

P.S., thanks for answering some of the questions in here! Guess I should
reformulate that last part.

