Beat the Baseline
Before Harborline renews the screening model's licence, the analyst has to show it beats the laziest rule anybody could write: give the same answer every time. On a stream where nine parcels in ten are clean, "never flag anything" scores 0.90 without examining a single parcel.
Task: Print the model's score, the lazy rule's score, and which of the two wins.
Input
The first line holds an integer n, the number of parcels. Each of the next n lines holds two values separated by a single space: the true label first, the model's label second. Both are 1 (banned item inside) or 0 (clean).
Output
Three lines. model X.XX is the share of parcels the model labelled correctly. baseline X.XX is the share the lazy rule would get, always answering with whichever true label is commoner in this batch. Both carry exactly two digits after the decimal point. The third line is beats baseline only when the model's score is strictly higher, and does not beat baseline otherwise.
Example:
Input:
5
1 1
1 1
1 0
0 0
0 1
Output:
model 0.60
baseline 0.60
does not beat baseline
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in