ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1375. Нонконформизм

Memory troubles?
Послано 2rf 7 июн 2009 14:51
Well, i have problems with this problem)

When I send C++ solutions with such declaration: int d[100000] I receive Crash (access violation) at test 8 as it should be. But when I change it to int d[1000000] I receive Crash (stack overflow) at test 1.

Why? What is stack overflow? I use (or should I say don't use?) neither local variables nor recursion. Or maybe I just think so.

Memory limit here is 16 MB and size of int d[1000000] is 4 MB, right? Help me please!

UPD: I got AC by changing int d[1000000] to vector<int> d(1000000) but I still want to know answer to my question.

Edited by author 07.06.2009 14:57
Re: Memory troubles?
Послано Sandro (USU) 7 июн 2009 18:44
You have got Stack Overflow, because declared local array
d[1000000] inside of main() function. Just declare it before main() and you will not have problems with stack.
Re: Memory troubles?
Послано 2rf 7 июн 2009 22:42
Big thanks for such quick and helpful response!