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

Обсуждение задачи 1322. Шпион

Показать все сообщения Спрятать все сообщения

Time Limit Exceeded VladG 2 окт 2006 23:08
I get "Time Limit Exceeded" error on 9 test.
Time: 0.281, Size: 424KB

I implemented Burrows - Wheeler algorithm in C++ in quite straight forward way (even without sorting).
What could be the problem and how it is possible to make it faster?
Re: Time Limit Exceeded VladG 2 окт 2006 23:31
I found the problem.
It was using 'string' class instead of just char array.
Probably when a string is long (100000 characters) then C++ allocate its memory in chucnks which make its access much more slower (or maybe because some limit checks).

Anyway, when I changes it to char array, it's running time was at least 10 time faster!!!