Problem 1867 --Color Circle

1867: Color Circle

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $6$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

     There are colorful flowers in the parterre in front of the door of college and form many beautiful patterns. Now, you want to find a circle consist of flowers with same color. What should be done ?

     Assuming the flowers arranged as matrix in parterre, indicated by a N*M matrix. Every point in the matrix indicates the color of a flower. We use the same uppercase letter to represent the same kind of color. We think a sequence of points d1, d2, … dk makes up a circle while:

    1. Every point is different.

    2. k >= 4

    3. All points belong to the same color.

    4. For 1 <= i <= k-1, di is adjacent to di+1 and dk is adjacent to d1. ( Point x is adjacent to Point y while they have the common edge).

    N, M <= 50. Judge if there is a circle in the given matrix. 

     There are multiply test cases.

     In each case, the first line are two integers n and m, the 2nd ~ n+1th lines is the given n*m matrix. Input m characters in per line. 

      Output your answer as “Yes” or ”No” in one line for each case. 

3 3
AAA
ABA
AAA
Yes

推荐代码 查看1867 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 时涛涛@计算机科学与技术162 84319 2017-04-26 22:15:49
内存最少[$1528 $KB] 时涛涛@计算机科学与技术162 84319 2017-04-26 22:15:49
第一AC 时涛涛@计算机科学与技术162 84319 2017-04-26 22:15:49
第一挑战 AOJ大管家 84162 2017-04-26 12:51:59

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛
1080 2017ACM集训赛 2017-04-26 12:00:00 请登录