Solutions for competitive programming problems were moved to Github

I moved solutions for problems that were previously hosted on this blog to https://github.com/binaryspaceship/competetive-programming-solutions. Check them out there.

As I am now a happy owner of domain thebigheadache.com, I plan to concentrate more on writing about distributed systems (microservices, monitoring, etc.) and machine learning in cloud (Spark, Hive, etc.). Related content, like C++ REST benchmark, will be moved to the new platform, and all other will be archived on Github.

Stay tuned, interesting times are coming!

Solution for “Empty and Divide” problem

Problem statement:

There are two boxes. Initially, one box contains m chips and the other contains n chips. Such a position is denoted by (m,n), where m > 0 and n > 0. The two players alternate moving. A move consists of emptying one of the boxes, and dividing the contents of the other between the two boxes with at least one chip in each box. There is a unique terminal position, namely (1, 1). Last player to move wins. Find all P-positions.

Continue reading