# Input: The adjacency list of a directed graph that has an Eulerian path. # Output: An Eulerian path in this graph. # Sample Input: # CTT -> TTA # ACC -> CCA # TAC -> ACC # GGC -> GCT # GCT -> CTT # TTA -> TAC # Sample Output: # GGCTTACCA import inout import common edge_strs = map(str.strip, inout.infilelines) graph = common.parse_graph_edges(edge_strs) path = common.find_eulerian_path(graph) inout.output(common.assemble_path(path))
# Input: An integer k. # Output: A k-universal circular string. # Sample Input: # 4 # Sample Output: # 0000110010111101 import inout import common k = int(inout.infilelines[0]) graph = common.k_universal_graph(k) cycle = common.find_eulerian_cycle(graph) inout.output(common.assemble_path(cycle[:-1])[:2**k])