영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
You are given a grid of letters. Your task is to find subgrids whose height and width is at least two and all the corners have the same letter.
For each letter, check if there is a valid subgrid whose corners have that letter.
Input
The first line has two integers n and k: the size of the grid and the number of letters. The letters are the first k uppercase letters.
After this, there are n lines that describe the grid. Each line has n letters.
Output
Print k lines: for each letter, YES if there is a valid subgrid and NO otherwise.
Constraints
- 1 ≤ n ≤ 3000
- 1 ≤ k ≤ 26
예제
예제 1
4 5 AAAA CBBC CBBE AAAA
YES YES NO NO NO