I don't remember exactly how this works, but I think when you declare
arrays like the ones you're making, you're putting them on the stack
instead of the heap, which gives them much less space to work with.

Generally I don't use arrays in C or C++ in programming contests: I use
vectors instead. I recommend replacing them with:
vector<vector<ll>> dancers(R, vector<ll>(C));
vector<vector<vector<ll>>> nebs(R, vector<vector<ll>>(C, vector<ll>(4)));

For convenience, you could typedef vector V;

An alternative is to declare the arrays on the heap, but I honestly don't
remember the syntax to do that for a 2+ dimensional array. Maybe:
auto dancers = new ll[R][C];
auto nebs = new ll[R][C][4];

And you'll need to delete[](dancers) and delete[](nebs) later. But again,
it's been a while, and I'm not sure I have that right. You'll have to
experiment to
(a) get it to compile, and
(b) make sure you aren't leaking memory.

Good luck!
Bartholomew

On Mon, Apr 13, 2020 at 10:09 AM Sahil Jain <jsahil...@gmail.com> wrote:

> My solution gives MLE even on the first testset, and I seemingly can't
> understand why! It's a mere implementation of the logic in the tutorial.
> My Code <https://ideone.com/DyPwvC>
> Is it because of the template code? Or is declaring a 3D array
> insensible(the innermost dimension is just 4, smh)?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/f7c8ab25-a02a-444c-968d-e472b703d6ce%40googlegroups.com
> <https://groups.google.com/d/msgid/google-code/f7c8ab25-a02a-444c-968d-e472b703d6ce%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAHaiWHNvPipO6SUyus5r8Zo%2B2QzQdM3%2BK1f%2BYk_LApcQwbPSKA%40mail.gmail.com.

Reply via email to