|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||32||16||13||52.000%|
A popular app has players line up a set of three candies of the same color in a row in order to remove them from the screen and continue playing. The candies come in six colors: blue, yellow, green, orange, purple, and red. They are arranged in a two-dimensional grid with horizontal rows and vertical columns. Once a player has moved candies to complete and remove a set of candies, the game must automatically find and remove any remaining sets of three candies of the same color in a row.
Your program must find and display the location of a valid set of three candies of the same color in a row (or column) or display “no set found.” If there is more than one valid set, your program may display the location of any one of the valid sets. The rows are numbered from 1 starting at the top. The columns are numbered from 1 starting at the left.
The input will start with a number representing the number of test cases. Each test case consists of one line containing two integers representing the number of rows and columns of the grid followed by a grid representing the colors of the candies.
The dimensions of the board will be at most 100 by 100.
Your output should be three ordered pairs of integers representing row numbers and column numbers, respectively, of a valid set if there is a valid set found. If there is no valid set found, your output should consist of the message “no set found.”
3 4 7 R R Y B O G P P G R Y O G B B G R Y O B Y P R G B Y B R 5 5 P G O B R G O B R P O B R P G B R P G O R P G O B 6 4 R O B Y Y O B R O B R Y G B G B R Y Y Y B G O R
1 5 2 5 3 5 no set found 5 2 5 3 5 4