cswork / OA打开练习工作台

AmazonOA #320

Order Layout

估计中等可在线判题

考点(AI 标注)字符串模拟/实现

Configuration entries are separated by vertical bars; each entry is a four-digit decimal sequence number immediately followed by a non-empty configuration value. A valid layout must have sequence numbers that are exactly 1..number of entries, with no duplicates or gaps, and configuration values that contain only ASCII letters and digits and are all distinct. Output the configuration values in sequence-number order; if any check fails, output ["Invalid configuration"]. Duplicate values may appear in the input being validated, but such input is invalid.

输入格式

One line containing layout. In the original statement the bound on orders and sequence numbers is 1..9999; the input may have missing or duplicate numbers. For invalid inputs, this site also allows 0..9999 separated entries with entry length 0..104, made of printable ASCII characters without whitespace; this site adds 1..100 characters for valid configuration values. The four-digit sequence number must consist of ASCII digits. Empty input is also an invalid layout to be validated.

输出格式

If the layout is valid, output a compact JSON array of strings ordered by sequence number; otherwise output ["Invalid configuration"].

样例 1

输入:

0002BB|0001AA

输出:

["AA","BB"]

样例 2

输入:

0001A|0002A

输出:

["Invalid configuration"]

样例 3

输入:

0002B|0002C

输出:

["Invalid configuration"]

样例说明

The outputs are ["AA","BB"], ["Invalid configuration"] and ["Invalid configuration"]. The second example openly shows the uniqueness check on configuration values that the source code omits; duplicate values cannot be accepted just because their sequence numbers differ.