Strange TLE caused by array initiizaion


  • 0
    T

    Hello Guys,

    I got TLE by this initialization:

        int mm[700][700];
    //  same code here
        for(int i=0;i<700;i++)
            for(int j=0;j<700;j++)
                mm[i][j]=-1;
    

    Then accepted by his:

        vector<vector<int> > mm;
    //  same code here
        for(int i=0;i<=N1;i++)
        {
            vector<int> vr(N2+1,-1);
            mm.push_back(vr);
        }
    

    Both have declaration in global and code in main() running only one time.

    Just feel weird of the cause.

    Can anyone educate me?

    Thanks.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.