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 1102. Strange Dialog

For those who dont know how to solve it
Posted by Olzhas2dy 12 Jun 2007 19:47
Well, here are some hints:
1. Use DFA. If you do'nt know what it is, visit this page http://en.wikipedia.org/wiki/Deterministic_finite_automaton (pay attention to the table of states)

2. use getc() instead of cin>>ch or cin.getch() or whatever you use (for C++/C only)

3. Try this:
3
outputoutputinputon

inputone

Edited by author 13.06.2007 17:36
Re: For those who dont know how to solve it
Posted by Boris Strandjev 19 Oct 2007 19:47
I would recommend using gets() for all that want to have the whole string at once. It still is fast enough and does not time limit.
Re: For those who dont know how to solve it
Posted by Entheogen 14 Nov 2007 05:12
How exactly do you use DFS for this?  Can you provide an example of some other problem similar to this which is solvable by DFS?  Thank you.
Re: For those who dont know how to solve it
Posted by Romko [Lviv NU] 14 Nov 2007 17:52
It's Not DFS problem!!!!! It's DFA(Deterministic finite automaton) problem!
Re: For those who dont know how to solve it
Posted by [SPbSU ITMO] Kazakov Sergey (CK.) 18 Apr 2008 21:08
I solved it with DFS in 0.453 sec.
Re: For those who dont know how to solve it
Posted by PersonalJesus 24 Jun 2008 21:06
When I was using STL, I always had TL on the first test but I was sure that this is the correct algo. Then I replaced all STL's strings with array of chars and I got ACC 0.078 . OMGWTF ?!
Re: For those who dont know how to solve it
Posted by Mahilewets 11 May 2017 16:41
First test is really large.  Something of order 1e6.
Re: For those who dont know how to solve it
Posted by guilty spark 5 Aug 2021 21:55
Its a simple substring search problem.