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

I used Grammar Gragh accepted this problem.There is some hint.
Posted by lzperfect 4 May 2004 16:54
You can divide those words into some basic words like
out,in,put,on,e.
  Then build a gragh which has 5 points expressing those 5 words mentioned above.
  f[i,j,k]means from i to j state[i]=k(k=1 means i must be a start,k=-1 means i must be a end,k=0 means both are ok)state[j]=f[i,j,k]);
  Read every basic words and DFS the gragh.
  The details are left for you:)