#P4259. [Code+#3] 寻找车位
[Code+#3] 寻找车位
Description
access_globe has a huge parking lot with rows and spaces per row. For aesthetics, when building this parking lot, access_globe stipulated that it must be strip-shaped, i.e., . Each parking space is a square area.
Recently, access_globe has been distressed about not being able to draw "Missing Poster", so he asks you to help maintain this parking lot. You need to support two types of events:
- A car parks in a certain space, or a car leaves a certain space.
- Query, within a rectangular region, the largest square region consisting only of empty spaces.
If you can help access_globe solve this efficiently, access_globe will reward you well.
Input Format
The first line contains three positive integers , , and , denoting the size of the parking lot and the number of events.
The next lines each contain numbers, either or . If the number at row , column is , then the space at row , column is empty; otherwise, that space is non-empty.
The next lines each describe an event in one of the following two forms:
- : The occupancy status of the space at row , column toggles. That is, if this space was empty before this event, it becomes non-empty after the event; otherwise, it becomes empty. It is guaranteed that , .
- : Query the side length of the largest all-empty square region within the rectangle with opposite corners and . It is guaranteed that , .
Output Format
For each query, output one integer on its own line, representing the side length of the largest all-empty square for that query.
5 4 10
1 1 1 0
1 1 1 1
1 1 0 1
1 0 1 0
1 1 0 0
1 1 1 5 4
1 3 1 3 1
1 3 3 3 3
1 2 3 5 3
0 2 2
1 1 4 2 4
1 1 3 3 3
0 5 1
1 2 3 2 4
1 1 2 2 4
2
1
0
1
1
1
1
1
Hint
| Subtask ID | Extra constraints on | Extra constraints on | Update operations | Whether guaranteed that |
|---|---|---|---|---|
| Present | No | |||
| None | Guaranteed absent | Yes | ||
| ^ | ^ | Present | ^ | |
| Guaranteed absent | ||||
| ^ | Present | |||
| Guaranteed absent | No | |||
| ^ | Present | ^ | ||
| Guaranteed absent | ||||
| ^ | Present | |||
| None | ^ |
All subtasks are evenly weighted.
For all testdata, it is guaranteed that , .
Credit: https://www.luogu.org/discuss/show?postid=35727
Translated by ChatGPT 5
京公网安备 11011102002149号