 <p>Test this version, updated using C++11 features. Tested in GCC 4.9.0 with <code>-std=c++11</code>. Tested on Celeron 1.6&nbsp;GHz, 512&nbsp;MB RAM.</p> <p>Times in my PC:<br> Original: <strong>Duration (milliseconds): 12658</strong><br> First Version: <strong>Duration (milliseconds): 3616</strong><br> Optimized Version: <strong>Duration (milliseconds): 1745</strong><br></p> <p>Changes are:</p> <ul> <li>Using <code>vector</code> instead of <code>list</code> <a href="http://blog.davidecoppola.com/2014/05/20/cpp-benchmarks-vector-vs-list-vs-deque/">Benchmark</a>, and <a href="https://isocpp.org/blog/2014/06/stroustrup-lists">Words from Stroustrup</a>.</li> <li>Using const whatever we can, the compiler is able to optimize much more if it known that the value don't change.</li> <li>Using std::pair instead of Point.</li> <li>Using new for-loop with constant iterators.</li> </ul> <p>Source:</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;chrono&gt; #include &lt;iomanip&gt; using namespace std; typedef std::pair&lt;int, int&gt; Point; #define LARGEUR_GRILLE 22 vector&lt;Point&gt; positions; bool verifierNonPrise(const Point&amp; emplacement) { bool nonPrise = true; for (const auto&amp; p : positions) { if (p.first != emplacement.first) { if (p.second == emplacement.second) { nonPrise = false; } if (abs(p.second - emplacement.second) == abs(p.first - emplacement.first)) { nonPrise = false; } } } return nonPrise; } bool placerDame(int i) { bool bonnePosition = false; for (int j = 1; j &lt;= LARGEUR_GRILLE &amp;&amp; !bonnePosition; j++) { Point emplacement(i, j); positions.emplace_back(emplacement); if (verifierNonPrise(emplacement) &amp;&amp; (i == LARGEUR_GRILLE || placerDame(i + 1))) { bonnePosition = true; } else { positions.pop_back(); } } return bonnePosition; } int main(int argc, char* argv[]) { std::chrono::system_clock::time_point begin_time = std::chrono::system_clock::now(); positions.reserve(LARGEUR_GRILLE); placerDame(1); for (const auto&amp; p : positions) { cout &lt;&lt; "(" &lt;&lt; p.first &lt;&lt; "; " &lt;&lt; p.second &lt;&lt; ")" &lt;&lt; endl; } std::chrono::system_clock::time_point end_time = std::chrono::system_clock::now(); long long elapsed_milliseconds = std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;( end_time - begin_time).count(); std::cout &lt;&lt; "Duration (milliseconds): " &lt;&lt; elapsed_milliseconds &lt;&lt; std::endl; return 0; } </code></pre> <p>Some more deep changes.</p> <p>Changes include:</p> <ul> <li>Returning as early as possible. As soon as the queen can not be placed.</li> <li>Returning to a simpler Point class.</li> <li>Using find_if algorithm for searching queen placement.</li> </ul> <p>Source (some recommendation updated):</p> <pre><code>#include &lt;algorithm&gt; #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;chrono&gt; #include &lt;iomanip&gt; using namespace std; struct Point { int x, y; }; #define LARGEUR_GRILLE 22 vector&lt;Point&gt; positions; bool verifierNonPrise(const Point&amp; emplacement) { return find_if(positions.cbegin(), positions.cend(), [&amp;emplacement](const Point&amp; p) { return (p.x != emplacement.x &amp;&amp; (p.y == emplacement.y || abs(p.y - emplacement.y) == abs(p.x - emplacement.x))); }) == positions.cend(); } bool placerDame(int i) { for (int j = 1; j &lt;= LARGEUR_GRILLE; j++) { Point emplacement{i, j}; positions.push_back(emplacement); if (verifierNonPrise(emplacement) &amp;&amp; (i == LARGEUR_GRILLE || placerDame(i + 1))) { return true; } else { positions.pop_back(); } } return false; } int main(int argc, char* argv[]) { std::chrono::system_clock::time_point begin_time = std::chrono::system_clock::now(); positions.reserve(LARGEUR_GRILLE); placerDame(1); for (const auto&amp; p : positions) { cout &lt;&lt; "(" &lt;&lt; p.x &lt;&lt; "; " &lt;&lt; p.y &lt;&lt; ")" &lt;&lt; endl; } std::chrono::system_clock::time_point end_time = std::chrono::system_clock::now(); long long elapsed_milliseconds = std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;( end_time - begin_time).count(); std::cout &lt;&lt; "Duration (milliseconds): " &lt;&lt; elapsed_milliseconds &lt;&lt; std::endl; return 0; } </code></pre>