全部评论 1

  • A85760."CTSC2018" dictionary tree
    NOI/NOI+/CTSC

    Add to question list
    Question correction
    Pass rate:
    0%

    Time limit:
    5.00s

    Memory limit:
    512MB

    Question description
    Access Globe has severalIncrementsequence of positive integers. He wrote down the decimal representation (without leading zeros) of each positive integer in these sequences of positive integers, with a comma between two adjacent integers.,separated. Access Globe treats this sequence as a sequence consisting ofStrings composed of numbers and commas, and then use a Trie tree to store these strings. You don't need to know what a Trie tree is. You only need to know that the Trie obtained by Access Globe is a rooted tree with node 0 as the root. There is a character on each edge, and from the root to each
    0

    9
    0−9leaf nodeThe string formed by concatenating the characters on the edge of the path in sequence is an increasing sequence of positive integers written by him.

    Cute little Tommy decided to tamper with the Trie tree. He first deletes some characters on the edges of the Trie, and then fills in other characters. In order not to be discovered, Tommy must ensure that the modified Trie still satisfies the above properties, that is, the string formed by sequentially splicing the characters on the edges on the path from the root to each leaf node is an increasing sequence of positive integers separated by commas, and each positive integer has noLeading zeros。

    Now that Tommy has deleted some characters on the side, please help him complete the "fill in the characters" operation. If there are multiple solutions, please output the solution with the smallest lexicographic order.

    Input format
    The input file contains multiple sets of data. The first line of the entire file is an integer., represents the number of data groups. For each set of data:
    T
    T

    The first line contains a string of length
    n
    nof, including only
    0
    0arrive
    9
    9、,and?string, no.
    i
    iintegers represent connected nodes
    i
    i

    1小时前 来自 江苏

    0

热门讨论