P10509 Parking Lot.

Description

You have an empty area. This area can be seen as a grid of $n \times n$ squares. There is a ring of walls around the outside of the area, and you cannot remove them. Now you want to plan parking spaces on this area and turn it into a parking lot. You want the lower-left corner of the area to be the entrance/exit of the parking lot. The entrance/exit cannot be planned as a parking space. Both the empty cells and the parking spaces are $1 \times 1$ squares, and each side of every square is parallel or perpendicular to the walls. Each parking space should be 4-connected to at least one empty cell (that is, at least one of its up, down, left, right neighbors is an empty cell), and this empty cell must be able to reach the entrance/exit by moving up, down, left, right some number of times, without passing through any parking space. The figure below shows one placement with the maximum number of parking spaces when $n = 4$, where red is parking spaces, blue is the entrance/exit, and white is empty cells. ![](https://cdn.luogu.com.cn/upload/image_hosting/r3qljdsr.png) For $n = 2023$, what is the maximum number of parking spaces that can be arranged?

Input Format

N/A

Output Format

A positive integer, representing your answer.

Explanation/Hint

Translated by ChatGPT 5