Logo
(追記) (追記ここまで)

7766번 - Pseudographical recognizer 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB46262454.545%

문제

Let us define a pseudographical image to be a rectangular matrix of the characters ’.’, ’-’, ’|’, ’\’, and ’/’.

The character ’.’ denotes empty space on the image. A horizontal line segment is given as a set of ’-’ characters in adjacent cells in the same row of the matrix. A vertical line segment is given as a set of ’|’ characters in adjacent cells in the same column of the matrix. Similarly, a diagonal line segment is given as a set of ’/’ or ’\’ characters in adjacent cells in the same diagonal of the matrix. Of course, a line segment going from Northwest to Southeast has to be given using the ’\’ characters and a line segment going from Southwest to Northeast using the ’/’ characters.

Write a program that, given a pseudographical image, determines if it contains exactly one line segment – horizontal, vertical, or diagonal.

입력

The input contains several test cases. The first line contains the number of test cases T (1 ≤ T ≤ 100). Next follow the descriptions of each test case. The first line of the test case description contains two integers N and M (1 ≤ N, M ≤ 10), the number of rows and columns of the matrix, respectively. Each of the following N lines of the description contains exactly M symbols ‘.’, ‘-’, ‘|’, ‘\’, or ‘/’.

출력

The output consists of T lines, one line per each test case. This line should contain the word CORRECT if the input image contains exactly one line segment, or the word INCORRECT otherwise.

제한

예제 입력 1

5
5 5
.....
\....
.\...
..\..
.....
3 3
/..
./.
../
3 6
.|....
.|.---
.|....
3 3
...
...
...
1 1
/

예제 출력 1

CORRECT
INCORRECT
INCORRECT
INCORRECT
CORRECT

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > NEERC Western Subregional 2005 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /