TLE '17 Contest 3 P1 - Willson and Territory

View as PDF

Submit solution


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

Author:
Problem type
This is Willson's territory! Note his territorial markings.

Willson the Canada Goose is like any other Canada Goose - he can be territorial at times, especially to unfamiliar geese and unsuspecting humans.

Having just arrived in California for the first time, Willson's family decides to rest at the point (x_0,y_0). Willson walks around the area and finds N points of interest. The i^\text{th} point is (x_i,y_i).

Willson can only waddle horizontally or vertically. He determines that his territory consists of any point that requires no more than k units of waddling from his family's resting point, where k is the maximum number of units of waddling required from the resting point to a point of interest.

Willson wants to know the area of his territory, so he knows how much "territorial markings" he will need to use. Can you help him?

Input Specification

The first line of input will contain two space-separated integers, x_0 and y_0.

The next line of input will contain a single integer, N (1 \le N \le 10^5).

N lines of input follow. The i^\text{th} line will contain two space-separated integers, x_i and y_i.

All coordinates c satisfy 0 \le |c| \le 10^4.

Output Specification

Output a single integer, the area of Willson's territory. If your answer is not an integer, round it to the nearest one.

Sample Input

0 1
4
1 1
2 1
1 0
1 -1

Sample Output

18

Comments


  • 0
    bsef16m027  commented on March 18, 2018, 12:30 p.m.

    where is 'k' in the input?


    • 1
      aeternalis1  commented on March 18, 2018, 8:31 p.m.

      k is the maximum number of units of waddling required from the resting point to a point of interest.

      It isn't directly in the input, but implied.