The Cost-Sensitive Model
Harborline has finally put prices on the two ways of being wrong. Taping up a clean box costs a goodwill credit to an irritated customer; letting a banned item leave the depot costs a regulator's fine, and the fine is worth a great many credits. The manager wants the week priced rather than scored — not how often the model was wrong, but what being wrong cost.
Task: Print what the model's mistakes cost over the week.
Input
The first line holds two integers separated by a single space: the price of a needless inspection first, then the price of letting a banned item through. The second 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, each 1 (banned item inside) or 0 (clean).
Output
One line: a single whole number. Parcels the model got right cost nothing. Print 0 for a flawless week.
Example:
Input:
10 500
5
1 1
1 0
0 1
0 0
1 0
Output:
1010
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