More Pizza Problem

This is my solution for Google Hash Code's More Pizza Problem(Check out solution.cpp). It gives a score of 1,505,004,548. The complexity for this solution is n^2.