Random commentary about C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
I'm afraid you're wrong. Brute force solution runs within 0.78 sec, and it takes about 10 minutes to write it from scratch.The idea is that you don't need 0, and need 1-9, so that sum matches 45. Than you over-force problem for solution. As an easy corollary you understand that in center must be five, and other 4 pairs will than sum to 10 each.