I have a pretty good collection of WA for this problem

does anyone could give me some input/output data??
or a hint??
thanks for reading
Moderator: Board moderators
Output:1
1 3 5 3
1
8
0 0
0 4
2 4
2 2
4 2
4 4
6 4
6 0
????????????????Submarine 1 is partially on land.