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

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

why the tag for this problem is "data structures"?
Послано gio_gio 2 фев 2011 23:21
I do not argue, just I want to know.
Thanks.
Re: why the tag for this problem is "data structures"?
Послано Alipov Vyacheslav [Tomsk PU] 2 фев 2011 23:28
Because it can be solved using data structure called "stack".
Re: why the tag for this problem is "data structures"?
Послано gio_gio 2 фев 2011 23:29
Now I got it :) Thank you very much.
Re: why the tag for this problem is "data structures"?
Послано Flux 20 фев 2011 02:25
Stack<char> Stack = new Stack<char>();
foreach (char c in Console.ReadLine())
    if (Stack.Count > 0 && Stack.Peek() == c) Stack.Pop(); else Stack.Push(c);
foreach (char c in Stack.Reverse()) Console.Write(c);

Because of this code.
Re: why the tag for this problem is "data structures"?
Послано Nguyen Khac Tung 10 авг 2011 11:05
After AC i realized i used stack :)
Re: why the tag for this problem is "data structures"?
Послано Th3_g0d 25 окт 2011 12:24
Cuz' String Or a Char array is a data structure and working with data structures actually means changing adding expanding etc. them :) Hope that'll help you
Re: why the tag for this problem is "data structures"?
Послано Bogatyr 4 окт 2012 04:52
Yes, and because choosing the right data structure makes the problem solvable, and  choosing the wrong one results in TLE.   I had a brain blockage and couldn't think of stacks here (it's been a long time since I used them).   Trying to solve using, for example, STL vector or dequeue and erase() will result in TLE on the big input cases.    I realized that since very many erase() operations may be performed, delete performance is critically important, so STL list came to the rescue and got AC.