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

Обсуждение задачи 1709. Пингвин-Авиа

wa #1
Послано hyesun 22 апр 2014 13:21
I am wondering why i got wa on test #1.
I use dfs to color the edges. when one edge is not colored it means it makes a cycle and thus should be deleted. Next, every time I make dfs with a vertex, I connect it to a vertex processed before, which means the current vertex is connected to a component marked before.
Lastly I used long long to store the result.
But I just got wa on test #1.
Can anybody please tell me sth about test #1 ?
Lots of thanks
Re: wa #1
Послано hyesun 22 апр 2014 16:25
Oh damn it.
My first version of code is:
              int d, a, countd, counta;
                    ......
              long long money = d * countd + a * counta;

But I didn't realize that d * countd may have already overflowed.
So my AC version is:
              long long d, a, countd, count;
                     ......
              long long money = .....;
Thus if anyone got WA at test #1 and you are sure you have the right algo, you may have failed due to the same reason as mine.