Cutting with Lasers

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

A laser cutting machine for wood sheets has a laser head that can move in only two directions, horizontal and vertical. You have been hired to be part of the testing team for the machine.

One of the tests consists of programming the machine to perform a non-empty sequence of consecutive cuts that starts and ends at the same point. Each cut in the sequence, except the first, starts at the point at which the previous cut ended. No cuts touch the edge of the sheet to be cut. Figures (a) and (b) below show two examples of cutting sequences, with respectively 88 and 1414 cuts.

Your boss asked you to determine the area of the largest piece produced by the sequence of cuts, disregarding the piece attached to the edges of the cut sheet. That is, only the pieces contained in the polygon formed by the cut lines should be considered. Figures (c) and (d) below show respectively the largest pieces produced by the cuts of figures (a) and (b).

To illustrate, figures (e) and (f) below show the discarded piece (which contains the edges of the wood sheet) of the cut sequences of figures (a) and (b), respectively.

입력

The first line contains an integer NN, the number of cuts in the sequence (4N1044 ≤ N ≤ 10^4). The second line contains two integers X_0X\_0 and Y_0Y\_0, the initial position of the laser head in the sequence of cuts (1X_01031 ≤ X\_0 ≤ 10^3 and 1Y_01031 ≤ Y\_0 ≤ 10^3). Each of the next NN lines contains two integers X_iX\_i and Y_iY\_i , the final position of the cut ii (1X_i1031 ≤ X\_i ≤ 10^3 and 1Y_i1031 ≤ Y\_i ≤ 10^3, for 1iN1 ≤ i ≤ N, and (X_N,Y_N)=(X_0,Y_0)(X\_N , Y\_N ) = (X\_0, Y\_0)). All positions given in the input are distinct, except the first and the last positions.

출력

Your program must output a single line, containing a single integer, the area of the largest piece produced by the sequence of cuts.