Lateral Damage
Time limit2sMemory limit1024 MB
Locate and sink all up to ten hidden aircraft carriers (length 5 each) on a grid of at most 100 by 100 using at most 2500 shots.
- Level
Medium6 of 10
- Topics
- Simulation, Greedy, Implementation
- Solved
- No attempts yet
Problem
You are playing Battleships in a large ocean with large ships. More precisely, there is a large square grid of size at most and inside it are up to of the largest type of ship in Battleships, the aircraft carrier. Each carrier has a length of five tiles and is placed either horizontally or vertically. The ships do not overlap, but they may be adjacent to each other. See Figure L.1 for an example.

Figure L.1: The board after the first four shots.
Your opponent appears to bend the rules to their liking. They do not always fix the placement of their ships before you start shooting. You are not impressed by this attempt at cheating, so you decide to win the game anyway.
Your goal is to locate and sink all of your opponent's aircraft carriers in at most shots. You must hit each of the five tiles of all their ships.