#P9284. [AGM 2023 资格赛] 海盗
[AGM 2023 资格赛] 海盗
Problem Description
The pirates are in a rectangular sea area with rows and columns.
Next, there will be bombs. The area covered by each bomb is a rectangle.
The pirates have ships. Each ship is either several columns in one row, or several rows in one column. For each ship, you need to output:
MISS The ship is not covered by any bomb;
HIT The ship is covered by bombs, but not completely covered;
SUNK The ship is completely covered by bombs.
Input Format
The first line contains two positive integers .
The next line contains one integer .
The next lines each contain four positive integers $x1,y1,x2,y2(1\leq x1\leq x2\leq N,1\leq y1\leq y2\leq M)$, representing the bomb coverage area.
The next line contains one integer .
The next lines each contain four positive integers . If , it means the -th ship consists of columns to in row . Otherwise, if , it means the ship consists of rows to in column .
Ships may intersect with other ships, and bombs may intersect with other bombs.
Output Format
Output lines. For each ship, output the answer.
5 5
3
2 1 2 2
2 2 3 3
3 4 5 4
5
1 2 1 3
1 2 1 4
2 1 3 5
1 3 2 4
2 2 1 5
SUNK
HIT
MISS
SUNK
HIT
Hint
Translated by ChatGPT 5