RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00003

C. Ancient Messages

Unrated 레이팅 미적용
난이도
3s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

In order to understand early civilizations, archaeologists often study texts written in ancient languages. One such language, used in Egypt more than 3000 years ago, is based on characters called hieroglyphs. Figure C.1 shows six hieroglyphs and their names. In this problem, you will write a program to recognize these six characters. Ankh Wedjat Djed Scarab Was Akeht Figure C.1: Six hieroglyphs

제약
입력 형식

The input consists of several test cases, each of which describes an image containing one or more hieroglyphs chosen from among those shown in Figure C.1. The image is given in the form of a series of horizontal scan lines consisting of black pixels (represented by 1) and white pixels (represented by 0). In the input data, each scan line is encoded in hexadecimal notation. For example, the sequence of eight pixels 10011100 (one black pixel, followed by two white pixels, and so on) would be represented in hexadecimal notation as 9c. Only digits and lowercase letters a through f are used in the hexadecimal encoding. The first line of each test case contains two integers, \(H\) and W. H (\(0 < H \le 200\)) is the number of scan lines in the image. \(W\) (\(0 < W \le 50\)) is the number of hexadecimal characters in each line. The next \(H\) lines contain the hexadecimal characters of the image, working from top to bottom. Input images conform to the following rules:

  • The image contains only hieroglyphs shown in Figure C.1.

  • Each image contains at least one valid hieroglyph.

  • Each black pixel in the image is part of a valid hieroglyph.

  • Each hieroglyph consists of a connected set of black pixels and each black pixel has at least one other black pixel on its top, bottom, left, or right side.

  • The hieroglyphs do not touch and no hieroglyph is inside another hieroglyph.

  • Two black pixels that touch diagonally will always have a common touching black pixel.

  • The hieroglyphs may be distorted but each has a shape that is topologically equivalent to one of the symbols in Figure C.\(1^{1}\). The last test case is followed by a line containing two zeros. ^{1}Two figures are topologically equivalent if each can be transformed into the other by stretching without tearing.

출력 형식

For each test case, display its case number followed by a string containing one character for each hieroglyph recognized in the image, using the following code: Ankh: A Wedjat: J Djed: D Scarab: S Was: W Akhet: K In each output string, print the codes in alphabetic order. Follow the format of the sample output. The sample input contains descriptions of test cases shown in Figures C.2 and C.3. Due to space constraints not all of the sample input can be shown on this page. Figure C.2: AKW Figure C.3: AAAAA

예제 1
입력
100 25
0000000000000000000000000
0000000000000000000000000
...(50 lines omitted)...
00001fe0000000000007c0000
00003fe0000000000007c0000
...(44 lines omitted)...
0000000000000000000000000
0000000000000000000000000
150 38
00000000000000000000000000000000000000
00000000000000000000000000000000000000
...(75 lines omitted)...
0000000003fffffffffffffffff00000000000
0000000003fffffffffffffffff00000000000
...(69 lines omitted)...
00000000000000000000000000000000000000
00000000000000000000000000000000000000
0 0
ICPC 2011 World Finals Problem C: Ancient Messages
출력
Case 1: AKW
Case 2: AAAAA
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC World Finals 2011

평가 및 의견

C. Ancient Messages

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

C. Ancient Messages

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8