Substitution Cipher

From Progteam

(Difference between revisions)
Jump to: navigation, search
Line 18: Line 18:

Latest revision as of 22:57, 16 June 2008

Substitution Cipher
Problem Number 1506
Sorter: hjfreyer
Source: Unknown

Substitution Cipher is problem number 1506 on the Peking University ACM site.


  • Turn the input into a list of "e<b" style rules.
  • Construct a graph from these rules.
  • If graph has a cycle, or is disconnected, you can't do it
  • Else, it's a connected DAG.
  • Topological sort. Boom.

Personal tools