## CCC '09 S5 - Wireless

View as PDF

Points: 12 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
##### Canadian Computing Competition: 2009 Stage 1, Senior #5

Bob is sitting at home with his computer. He would like to experience more social interaction, so he is planning a trip to a coffee shop with his computer.

Bob has lots of data about wireless networks and coffee shops in the city. In Bob's city, there is one coffee shop at every intersection of streets. Specifically, Bob happens to live in a city with streets that run east and west, and streets that run north and south. As an added benefit, the distance between consecutive parallel streets is metre (it is a very compact city).

It also turns out that inside of the coffee shops, there is a wireless network station. Each wireless network station will have a particular bitrate and can reach metres from the coffee shop. In other words, a wireless network station from one coffee shop forms a circle with radius centered at that particular coffee shop. Moreover, if someone is at distance , the wireless network would be available, but if someone is at a distance larger than , they cannot access that wireless point.

You can assume that each coffee shop has at most one wireless network stationed in it, but that multiple wireless networks may be available while sitting in that one coffee shop, due to the proximity of other wireless network stations.

Bob has a special device in his computer that can use all of the available bitrates of as many wireless networks as he can connect to.

Bob would like to find out the maximum bitrate he can obtain, and how many coffee shops would have that maximum capacity.

#### Input Specification

On the first line of input, you will be given the integer , the number of east-west streets.
On the second line of input, you will be given the integer , the number of north-south streets.
On the third line of input, you will be given the integer , the number of coffee shops with a wireless network. On the next lines, you will have 4 integers per line.

The first integer on each line represents the north-south street on which the coffee shop is located, where . The second integer, , on each line represents the east-west street on which the coffee shop is located, where . The third integer, , on each line represents the radius of the wireless network from this particular coffee shop. The fourth integer, , on each line represents the bitrate of the wireless network from this particular coffee shop.

#### Output Specification

The output will be two lines long. The first line of output will be the integer representing the maximum bitrate that can be obtained over all coffee shops. The second line of output will be the number of coffee shops where this maximum bitrate can be obtained.

#### Sample Input

3
5
3
1 3 2 5
3 1 2 7
5 1 1 5

#### Sample Output

12
5

#### Explanation

In the figure below, notice that the five coffee shops/intersections marked with a dark circle have total bitrates of .

• commented on Jan. 8, 2018, 4:09 p.m.

need help

how to do 2d difference array for circles?

• commented on July 15, 2020, 7:27 p.m. edited

If you can do this problem

https://dmoj.ca/problem/ccc08s2

with time per circle, you can figure out a way to get updates with 1D difference arrays for this problem.

• commented on Oct. 11, 2022, 8:29 p.m.

Do you really mean 1D array???

• commented on Dec. 20, 2015, 3:00 p.m.

Considering the massive test cases in this question, is it solvable in python?

• commented on Dec. 21, 2015, 3:47 a.m.

Yes, just use PyPy.

• commented on Dec. 20, 2015, 6:16 p.m.

Write a solution to find out!

• commented on Dec. 20, 2015, 6:37 p.m.

Challenge accepted!

• commented on Dec. 17, 2015, 1:40 a.m.

Sourspinach - 956kb Everyone else - 115mb dat difference though