What's the difference between the given two codes. One gives time limit exceeded when run on ideone and the other works fine : <p>1st code: works fine gives success with time of 0sec</p>

<pre><code>    int main()
    {
      int n=100000;
      for(int i=0;i&lt;n;i++)
        for(int j=0;j&lt;n;j++)
         {}
      cout&lt;&lt;"ffdfdf";
    }
</code></pre>

<p>2nd code: gives a time limit exceeded</p>

<pre><code>    int main()
    {
      int n=100000;
      bool **a=new bool*[n];
      for(int i=0;i&lt;n;i++)
      {
        bool[i]=new bool[n];
        for(int j=0;j&lt;n;j++)
         {
           bool[i][j]=1;
         }
      }
      cout&lt;&lt;"ffdfdf";
    }
</code></pre>

<p>can anyone explain why the two code fragments have a vast time difference.I am not understanding it.</p>
