Interactive Treasure Hunt

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

This is an interactive problem.

There is a grid of n×mn\times m cells. Two treasure chests are buried in two different cells of the grid. Your task is to find both of them. You can make two types of operations:

  • DIG rr cc: try to find the treasure in the cell (r,c)(r, c). The interactor will tell you if you found the treasure or not.
  • SCAN rr cc: scan from the cell (r,c)(r, c). The result of this operation is the sum of Manhattan distances from the cell (r,c)(r, c) to the cells where the treasures are hidden. Manhattan distance from a cell (r_1,c_1)(r\_1, c\_1) to a cell (r_2,c_2)(r\_2, c\_2) is calculated as r_1r_2+c_1c_2|r\_1 - r\_2| + |c\_1 - c\_2|.

You need to find the treasures in at most 7 operations. This includes both DIG and SCAN operations in total. To solve the test you need to call DIG operation at least once in both of the cells where the treasures are hidden.