Want to try solving this problem? You can submit your code online if you log in or register.

You run an online dating site with many users. You keep detailed
statistics for each user, including the number of times they visit
your site this month. You would like to know how many visits your site
gets in total this month. Unfortunately this is not as easy as it
sounds – some of your users are *spammers*, who use your site to
advertise their own products. You do not want to count the spammers'
visits towards your total.

When a user registers with the site, they must supply many personal
details including their age, height and weight. Spammers lie about
these details, but they are very predictable and you can use their
fake answers to spot them. For example, you might know that "any user
whose age is between 18 and 30, whose height is between 80cm and
90cm, *and* whose weight is between 40kg and 50kg is a
spammer".

Your task is to write a computer program that takes a number of statements like the above and a list of user statistics, and outputs the total number of visits your site has received this month.

Your program must read from standard input.
In the description below,
*a _{i} h_{i} w_{i} v_{i}*
represent a user's age, height, weight and number of visits this month,
respectively.

The first line will consist of two space-separated integers,
*S* and *U*
(*1 ≤ S,U ≤ 1,000,000*). Each of the following
*S* lines will be of the form
"*a _{min}a_{max}h_{min}h_{max}w_{min}w_{max}*",
representing the statement "any user that satisfies

All ages, heights and weights are integers between 0 and 99 inclusive. Each user will make between 1 and 1000 visits, inclusive.

See the *Scoring* section for a breakdown of the marks awarded for
different test cases.

Your program must write to standard output.
The output should consist of a single integer: the number of visits made
to your site this month by users who are *not* spammers.

2 3 18 24 30 60 80 85 21 30 40 50 0 99 18 30 80 3 25 35 86 5 23 45 82 7

5

The score for each input scenario will be 100% if the correct answer is written to the output file, and 0% otherwise.

The following table lists the sizes of the inputs used in the test data.
Here, *N*-1 is the maximum age, height and weight specified in the input.

N | S | U | Percentage of marks |

20 | 10 | 1000 | 10% |

20 | 100 | 8000 | 10% |

10 | 10000 | 100000 | 10% |

30 | 10000 | 1000000 | 10% |

50 | 100000 | 100000 | 20% |

100 | 1000000 | 500000 | 20% |

100 | 1000000 | 1000000 | 20% |

Privacy
statement

© Australian Mathematics Trust 2001-2024

Page generated: 27 February 2024, 2:06am AEDT