← 返回 openai 的题目列表Find the Incorrect Data Labeler
类型:online_judge
Coding Problem: Find the Lowest-Quality Data Labeler
You are cleaning a dataset of human annotations. Each record contains:
item_id: the ID of the labeled item
labeler_id: the ID of the human labeler
label: the label assigned by that labeler
The same item_id is usually labeled by multiple labelers. Assume the true label of each item is represented by the majority-vote label among all annotations for that item.
Find the labeler with the worst overall labeling quality, defined as the labeler_id with the highest fraction of annotations that disagree with the majority-vote label.
If multiple labelers have the same error rate, output the lexicographically smallest labeler_id.
Input Format
The first line contains an integer n, the number of annotation records.
The next n lines each contain three strings:
item_id labeler_id label
Fields are separated by spaces.
Output Format
Print one string: the labeler_id of the lowest-quality labeler.
Constraints
1 <= n <= 200000
item_id, labeler_id, and label are strings without spaces
Each item_id has at least one annotation
If there is a tie for the majority-vote label of an item, choose the lexicographically smallest label
Example
Input:
9
q1 alice cat
q1 bob cat
q1 charlie dog
q2 alice dog
q2 bob dog
q2 charlie cat
q3 alice red
q3 bob blue
q3 charlie red
Output:
charlie
Explanation:
For q1, the majority label is cat; charlie is wrong.
For q2, the majority label is dog; charlie is wrong.
For q3, the majority label is red; bob is wrong.
Error rates:
alice: 0/3
bob: 1/3
charlie: 2/3
Therefore, output charlie.
Example
Input
9
q1 alice cat
q1 bob cat
q1 charlie dog
q2 alice dog
q2 bob dog
q2 charlie cat
q3 alice red
q3 bob blue
q3 charlie red
Output
charlie