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

Обсуждение задачи 1367. Конфиденциально!

Precautions
Послано Denis Koshman 24 авг 2008 05:35
Some implementation bugs I had

1. Some secret may become reachable several times from different sides when filling some area. Make sure that list of reachable secrtets does not overflow due to that.

2. If you test touching the secret along with testing walls, make sure you don't write something like that

if(!has_wall(...) || !has_wall(...))

where has_wall() returns true/false along with adding newly discovered secret to the list. The danger here is that if 1st operand of || is 'true', the 2nd one is not even evaluated according to C++ standard. So it might happen that some secret is not added to the list because 'has_wall' is not called due to free passage on the neighboring wall. But it's safe to replace boolean || with binary |. The latter is always evaluated for both operands even if the 1st one returns -1 (all ones).