ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1654. Cipher Message

why the tag for this problem is "data structures"?
Posted by gio_gio 2 Feb 2011 23:21
I do not argue, just I want to know.
Thanks.
Re: why the tag for this problem is "data structures"?
Posted by Alipov Vyacheslav [Tomsk PU] 2 Feb 2011 23:28
Because it can be solved using data structure called "stack".
Re: why the tag for this problem is "data structures"?
Posted by gio_gio 2 Feb 2011 23:29
Now I got it :) Thank you very much.
Re: why the tag for this problem is "data structures"?
Posted by Flux 20 Feb 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"?
Posted by Nguyen Khac Tung 10 Aug 2011 11:05
After AC i realized i used stack :)
Re: why the tag for this problem is "data structures"?
Posted by Th3_g0d 25 Oct 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"?
Posted by Bogatyr 4 Oct 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.