IBMOA #10
Prediction Diff (JSON Key Recommendations)
估计简单可在线判题
Compare two JSON objects and return the top-level keys that exist on only one side or whose values differ between the two sides, in ascending lexicographic order of Unicode code points. Object key order does not affect equality, arrays are ordered, a bool differs from a number, and a missing key differs from null; numbers are compared by their exact decimal value.
输入格式
The input is exactly two lines of JSON objects, optionally followed by one final newline; CRLF is supported. On this site the total UTF-8 size is ≤4MiB; each root has ≤1000 keys, each tree has ≤10000 value nodes, and container depth is ≤20 (the root counts as 1); every key is ≤64 code points, and string values are ≤256 code points and may be empty; text must consist of valid Unicode scalar values, and duplicate keys are rejected. Full JSON values are supported: object/array/string/number/bool/null. Numbers have absolute value ≤10^9 and are integer multiples of 10^-6, a number token is ≤64 characters, the absolute value of the exponent is ≤12, and equivalent decimal, exponent and −0 forms are supported.
输出格式
Output a JSON array of strings in ascending order with no duplicates; equivalent encodings with whitespace and valid escapes are allowed.
样例 1
输入:
{"hacker":"rank","input":"output"}
{"hacker":"ranked","input":"wrong"}
输出:
["hacker", "input"]
样例 2
输入:
{"a":null,"b":true}
{"b":1}
输出:
["a", "b"]
样例 3
输入:
{"a":1e-6,"b":-0,"c":{"x":1,"y":2}}
{"a":0.000001,"b":0.0,"c":{"y":2.0,"x":1}}
输出:
[]
样例说明
The examples give ["hacker","input"], ["a","b"] and [] respectively; different number formats do not count as a difference.