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

Обсуждение задачи 1654. Шифровка

how to solve it in 15ms?can anyone tell me???
Послано kratos 30 июн 2011 21:52
how to solve it in 15ms?can anyone tell me???
Re: how to solve it in 15ms?can anyone tell me???
Послано AterLux 1 июл 2011 14:02
First you must assume that this judge-system has strange time-measurement (also as memory-measurment) method.
So even solution that do nothing, or do simple thing (like problem 1000) can be notified to execute 0,015 or 0,031 time. Several submits of the same solution can show different time.

Second, solutions requires some overhead-time for initialization. For example for pascal it about 0.01 sec, for C++ - a little lower, for Java - 0.04 or more, so, even if you have good solution, it can take more time than you need.

Second, this problem solution requires a loading of whole string into memory as byte-array and one-pass algorithm, that for 200000 will require about 0,005 sec. So way you have to look - is to optimize your input-reading.

In C++ or Java you can read input as binary file into predefined byte-array. In Pascal - you can read file line-by-line, but into array of char - that is significant faster than reading char-by-char, or into variable-size strings

Edited by author 01.07.2011 14:04