Lateral Damage

시간 제한2초메모리 제한1024 MB

요약
최대 10척의 길이 5인 가로 또는 세로 전함을 100x100 격자에서 2500번 이하의 사격으로 모두 찾아내야 한다.
난이도

보통10점 중 7점

유형
게임 이론, 구현, 시뮬레이션, 그리디
정답자
아직 제출이 없습니다

문제

You are playing Battleships in a large ocean with large ships. More precisely, there is a large square grid of size at most 100×100100\times 100 and inside it are up to 1010 of the largest type of ship in Battleships -- the aircraft carrier -- which has a length of five tiles, placed either horizontally or vertically. The ships do not overlap, but they are allowed to be adjacent to each other. See Figure L.1 for an example.

Unfortunately, your opponent appears to bend the rules to their liking. It looks like they do not always determine the placement of their ships before you start shooting. You are not impressed by their attempt at cheating, and decide to try and win the game anyway.

Figure L.1: Illustration of Sample Interaction 1 after the first four shots were fired.

Your goal is to locate and sink all your opponent's aircraft carriers in at most 25002500 shots, that is, you must hit each of the five tiles of all their ships.

예제1

  1. 예제 1

    입력
    7 2
    
    miss
    
    hit
    
    miss
    
    hit
    
    hit
    
    hit
    
    hit
    
    sunk
    
    miss
    
    miss
    
    hit
    
    miss
    
    hit
    
    hit
    
    sunk
    
    예상 출력
    
    6 1
    
    6 3
    
    7 3
    
    5 3
    
    4 3
    
    3 3
    
    2 3
    
    1 3
    
    6 7
    
    6 7
    
    6 2
    
    6 2
    
    6 4
    
    6 5
    
    6 6