|  | 
|  | 
| back to board | actually this is an easy problem! no bitwise shit needed, no storing 17 bits for indexes and no such stuff! just use unsigned stack* [1000] for the stacks (store elements in a dynamic array, reallocating memory for each push), and unsigned  top[1000] for the index of the top element. with this i got AC with 663 KB! good luck!Re: actually this is an easy problem! Looks like solve the problem in such a manner is no longer possibleBecause ,as of 2017, there is no Intel C++ compiler
 
 And every other compiler fails to allocate memory effective
 
 Probably when reallocating there  are empty spaces  which count  as memory used
 
 And Intel Compiler was able to get rid of such spaces.
Re: actually this is an easy problem! После того как наконец сдал,  хочется сказать,  что на самом деле OP очень переусложнил задачу,  динамическая память не нужна.
 Достаточно статического выделения.
 Которое к слову очень быстро работает  -- за 31 мс.
Re: actually this is an easy problem! Я много раз ловил WA#8.Здесь предлагали тест на WA#8.
 Тест у меня работал хорошо.
 Ошибка,  как выяснилось,  была в том,  что я перепутал переменную с названием block_size с переменной block_cnt.
 
 Edited by author 26.07.2017 16:19
Re: actually this is an easy problem! Одно из решений использовало сдвиг O(N)  ячеек массива каждую операциюЦеной диких оптимизаций удалось довести его до TLE#16
 (только на Clang,  любой другой компилятор C++ позволял получить только TLE#12)
 
 Edited by author 26.07.2017 16:21
 | 
 | 
|