cswork / OA打开练习工作台

AmazonOA #312

Number of Duplicates

估计简单可在线判题

考点(AI 标注)哈希计数

Each product is recorded as a name, price and weight. A product is a duplicate if some other product matches it in all three fields. Find the number of products that satisfy this condition; the first product of each duplicate group also counts, so two identical products contribute 2 and three contribute 3. This is not the number of deletions needed to remove duplicates.

输入格式

Standard input is a JSON array whose items are [name,price,weight]. The original bounds are 1≤n≤100000, 1≤price,weight≤1000, and name consists only of lowercase letters with at most 10 characters. An empty name of length 0 is kept and encoded as the JSON string "", and no non-empty lower bound is added.

输出格式

Output a single integer, the answer.

样例 1

输入:

[["a",1,1],["a",1,1]]

输出:

2

样例 2

输入:

[["a",1,1],["a",1,2],["b",1,1]]

输出:

0

样例 3

输入:

[["",2,3],["",2,3],["",2,3]]

输出:

3

样例说明

The answers are 2, 0 and 3. This site openly resolves the ambiguity with the original per-product definition, "a product is a duplicate if another identical product exists". The source explanation's claim that the first item is usually not counted differs from the formal definition and its code, so it is not adopted.