Pro.ID22816 TitleSpy Cam Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22816 AC1 Submit1 Ratio100.00% 时间&空间限制描述An overhead camera has snapped a photoof the papers on a bureaucrat's desk. Many of the papers overlap, but, because the bureaucrat in questions is a bit of a neatness freak, all papers are aligned with their edges parallel to the edges of the desk. As a preliminary step in analyzing these papers, other programs have used cues of paper color, edges, etc., to label each pixel in the image according to which sheet of paper is visible in that particular location. The result will look something like this ...aaaaaaaa.dd A '.' denotes the desktop, and alphabetic labels 'a', 'b', 'c', etc., denote distinct pieces of paper. These labels are assigned in an arbitrary order but are dense (no letters are "skipped" during the labeling). Assume that each paper is rectangular, and that no important information is being lost "between" the pixels. Assume also that the camera has recorded the entire desktop and that there are no papers that are completely hidden from view. For each piece of paper (ordered bylabel), determine if the visual evidence proves that the entire sheet of paper is visible or if it is at least possible that a portion of the paper is hidden beneath another sheet. 输入Input will consist of several snapshots. Each snapshot begins with a linecontaining two integers, R and C, denoting the number of rows and columns of pixels in the snapshot. For each snapshot, 1 ≤ R, C ≤ 40. The R and C values are followed by R lines, each containing C characters. Those characters will be lower-case alphabetic characters or a period ('.'). As noted earlier, the alphabetic characters denote visible portions of distinct sheets of paper and the periods denote portions of the underlying desktop. All snapshots in the input will correspond to a valid arrangement of rectangular sheets of paper. There will be no impossible arrangements. The final snapshot will be followed by a line containing two zeros separated by a space. 输出Description An overhead camera has snapped a photoof the papers on a bureaucrat's desk. Many of the papers overlap, but, because the bureaucrat in questions is a bit of a neatness freak, all papers are aligned with their edges parallel to the edges of the desk. As a preliminary step in analyzing these papers, other programs have used cues of paper color, edges, etc., to label each pixel in the image according to which sheet of paper is visible in that particular location. The result will look something like this ...aaaaaaaa.dd A '.' denotes the desktop, and alphabetic labels 'a', 'b', 'c', etc., denote distinct pieces of paper. These labels are assigned in an arbitrary order but are dense (no letters are "skipped" during the labeling). Assume that each paper is rectangular, and that no important information is being lost "between" the pixels. Assume also that the camera has recorded the entire desktop and that there are no papers that are completely hidden from view. For each piece of paper (ordered bylabel), determine if the visual evidence proves that the entire sheet of paper is visible or if it is at least possible that a portion of the paper is hidden beneath another sheet. Input Input will consist of several snapshots. Each snapshot begins with a linecontaining two integers, R and C, denoting the number of rows and columns of pixels in the snapshot. For each snapshot, 1 ≤ R, C ≤ 40. The R and C values are followed by R lines, each containing C characters. Those characters will be lower-case alphabetic characters or a period ('.'). As noted earlier, the alphabetic characters denote visible portions of distinct sheets of paper and the periods denote portions of the underlying desktop. All snapshots in the input will correspond to a valid arrangement of rectangular sheets of paper. There will be no impossible arrangements. The final snapshot will be followed by a line containing two zeros separated by a space. Output For each snapshot, print one line of output. That line will begin with the phrase "Uncovered:" followed by a single space. Then, on the same line, list the papers that are definitely completely visible, in order of character code, with no separating spaces. Sample Input 3 3 Sample Output Uncovered: a Source 样例输入3 3 样例输出Uncovered: a 作者 |