The Troublesome Frog

Source: Internet
Author: User

"Title description"

The trail of the frog through the farmland is a straight line, the farmland plants are in the farmland of the two-dimensional coordinate system of the integer lattice point, if a frog through the farmland, that is, along a straight line through the farmland, then the straight line through the whole number of the lattice point of the plant will be destroyed, now give the location of all the destroyed plant Ask which frog destroys the most plants.

"Input description"

The first line contains two integer r,c, representing the number of rows and columns in the field (1 <= r,c <= 5000). The second line contains an integer n representing the number of destroyed plants (3 <= N <= 5000). The following n rows each row contains 2 integers representing the number of rows of this plant x (1 <= x <= R) and number of columns Y (1 <= y <= C). Each of the destroyed plants appears only once.

"Output description"

The output destroys the number of plants destroyed by the frogs that destroy the most plants. If not present, the output is 0.

"Input Sample"

6 7

14

2 1

6 6

4 2

2 5

2 6

2 7

3 4

6 1

6 2

2 3

6 3

6 4

6 5

6 7

"Output Example"

7

The Troublesome Frog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.