Home c++ codeblocks Error starting the program 0xc00000fd

codeblocks Error starting the program 0xc00000fd

Author

Date

Category

wrote a three-dimensional Fenwick tree on C++, start a program, it crashes with a 0xC00000FD error code, here’s code:

# include & lt; bits / stdC++. H & GT;
Using Namespace STD;
#Define Maxn 210.
Long long n, x1, y_1, z1, x2, y2, z2, q, k, a [maxn] [maxn] [maxn], operator;
Struct Fenwick.
{
  Long Long T [MAXN] [MAXN] [MAXN];
  Void Buildt ()
  {
    for (int i = 1; i & lt; = maxn; i ++)
      for (int j = 1; j & lt; = maxn; j ++)
        For (int u = 1; u & lt; = maxn; u ++)
          t [i] [j] [u] = 1;
  }
  Void Add (Long X, Long Long Y, Long Long Z, Long Long Value)
  {
    X ++;
    y ++;
    z ++;
    A [x] [y] [z] + = value;
    For (Long Long i = x; i & lt; maxn; i + = (i & amp; -i))
      For (Long Long j = y; j & lt; maxn; j + = (j & amp; -j))
        For (Long Long U = z; u & lt; maxn; u + = (u & amp; -u))
          t [i] [j] [u] + = value;
  }
  Long Long SumPref3D (Long Long X, Long Long Y, Long Long Z)
  {
    X ++;
    y ++;
    z ++;
    Long Long Sum = 0;
    For (long long i = x; i & gt; 0; i - = (i & amp; -i))
      FOR (Long Long J = Y; j & gt; 0; j - = (j & amp; -j))
        For (Long Long U = z; u & gt; 0; u - = (u & amp; -u))
          Sum + = T [i] [j] [u];
    Return Sum;
  }
  Long Long Sumpara (Long Long X1, Long Long Y1, Long Long Z1, Long Long X2, Long Long Y2, Long Long Z2)
  {
    RETURN SUMPREF3D (X1, Y1, Z1) -
        SUMPREF3D (X1, Y1, Z2-1) -
        SUMPREF3D (X1, Y2-1, Z1) -
        SUMPREF3D (X2-1, Y1, Z1) +
        SUMPREF3D (X1, Y2-1, X2-1) +
        SUMPREF3D (X2-1, Y1, Z2-1) +
        SUMPREF3D (X2-1, Y2-1, Z1) -
        SUMPREF3D (X2-1, Y2-1, Z2-1);
  }
  Void ChangeValue (Long X, Long Long Y, Long Long Z, Long Long K)
  {
    add (x, y, z, k);
  }
};
INT MAIN ()
{
  Fenwick Fenwick;
  fenwick.buildt ();
  ScanF ("% LLD", & amp; n);
  While (True)
  {
    Scanf ("% LLD", & amp; Oper);
    if (opera == 3) Break;
    ELSE If (operator == 1)
    {
      ScanF ("% LLD% LLD% LLD% LLD \ N", & amp; x1, & amp; y_1, & amp; z1, & amp; k);
      fenwick.changevalue (x1, y_1, z1, k);
    }
    ELSE If (Oper == 2)
    {
      SCANF ("% LLD% LLD% LLD% LLD% LLD% LLD \ N", & amp; x1, & amp; y_1, & amp; z1, & amp; x2, & amp; y2, & amp; z2);
      PrintF ("% LLD \ N", fenwick.sumpara (x1, y_1, z1, x2, y2, z2));
    }
  }
}

Answer 1, Authority 100%

You hardly have such a big stack that is able to withstand an array of 9261000 elements of 8 bytes – more than 70 megabytes …

Select such large arrays dynamically.

In addition, you forget that arrays are indexed, starting from scratch, and choose their borders – for example, here:

for (int i = 1; i & lt; = maxn; i ++)
  for (int j = 1; j & lt; = maxn; j ++)
    For (int u = 1; u & lt; = maxn; u ++)
      t [i] [j] [u] = 1;

Next to the correctness of the code did not watch.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions