Code(C++) crashing when allocating 2-D arrays

Revision en1, by send_nodes, 2015-08-23 23:28:37

I've been having a problem with 2-D arrays for a while. If I allocate a 2-D array with dimensions 1000x1000, then when I debug, the program crashes. For example, this code is crashing:

#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <fstream>
#include <cstring>
#include <string>

using namespace std;

//macros
typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;




#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define INF 99999999
#define MOD 1000000007
#define MAX 100000
#define ITERS 10000
#define pi 3.1415926

int main(){
	int n,m;
	cin >> n >> m;
	int arr[1000][1000];
	REP(i,n){
		REP(j,m){
			int nxt;
			cin >> nxt;
			arr[i][j] = nxt;
		}
	}
	int dpa[1000][1000];
	int dpb[1000][1000];
}

I'm using MinGW GCC g++ 4.8.1. Any ideas on what the issue is? When I run, I get an error message saying:

".exe has stopped working. Windows is checking for a solution to the problem..."

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English send_nodes 2015-08-23 23:28:37 1602 Initial revision (published)