#K45162. Longest Path on Chessboard

    ID: 27693 Type: Default 1000ms 256MiB

Longest Path on Chessboard

Longest Path on Chessboard

Given an ( n \times n ) chessboard and a starting position ( (x, y) ), determine the maximum number of cells that can be visited if each cell is traversed at most once. Since the longest possible path is one that visits every cell exactly once, the answer is simply ( n^2 ). This problem tests basic arithmetic and understanding of grid structures.

inputFormat

The input consists of a single line containing three space-separated integers ( n ), ( x ), and ( y ), where ( n ) (1 ≤ ( n ) ≤ 10^5 for example) is the size of the chessboard (i.e. the board has ( n ) rows and ( n ) columns), and ( (x, y) ) (1-indexed) represents the starting position on the board.

outputFormat

Output a single integer which is the length of the longest path possible on the chessboard without visiting any cell more than once. In other words, output ( n^2 ).## sample

1 1 1
1

</p>