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

Обсуждение задачи 1196. Экзамен по истории

AC 0.046s! HINT for you to get 0.078
Послано tiancaihb 30 авг 2009 19:53
First I used binary search, 0.271s, that's a bit slow.
So I used hash, 0.156s, still not fast enough.
I guess the biggest problem is that input is not very quick, then I decided to make a special "scanf" which reads chars one by one and translate them into int.
It's very useful, it worked in 0.078s.
After that, I optimized other staff. It's 0.062s.
And... With a little luck... I've got 0.049s once, with the same code.

In a word, my HINT for you to get 0.078s is:
USE HASHTABLE AND YOUR OWN INPUT FUNCTION!

Forgive me if my English is not very good. Hope these can help you guys somehow. Good luck.
Re: AC 0.046s! HINT for you to get 0.078
Послано gvsmirnov 3 окт 2009 06:57
You can get it even better:)
Some perversion involved, though.
Re: AC 0.046s! HINT for you to get 0.078
Послано tiancaihb 3 окт 2009 14:53
Yeah, I saw your submissions this morning, 0.031s. Orz

Edited by author 03.10.2009 14:54
Re: AC 0.046s! HINT for you to get 0.078
Послано gvsmirnov 4 окт 2009 04:52
Though, I still don't like that sometimes the same code can get different running time.
Re: AC 0.046s! HINT for you to get 0.078
Послано tiancaihb 4 окт 2009 19:29
Yeah, my 0.046s is absolutely by chance. I just came up with a new idea to make it quicker, I'll try it out...
But how do some people get 0.001s at some problem? I even can't get it at 1000!

Edited by author 04.10.2009 19:35