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

31011번 - Heiroglyphics 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB47191435.000%

문제

An excavation of some newly discovered buildings recently found on the lost continent of Atlantis have yielded a surplus of new hieroglyphs. The hieroglyphs are written on tablets and each symbol is a short sequence of 6 characters containing bars and/or circles (similar to the look of binary code). Your fellow archaeologists have recovered several sets of unblemished tablets and have deciphered their meaning. From these tablets a possible grammar and alphabet has been proposed. However there are many imperfect tablets with lost information. Your job is to determine how many different letter combinations in a tablet are possible given a sequence of symbols that have missing or undecipherable parts.

Your fellow archeologists have noted that there are special "vowel" symbols that have special rules. For this problem these patterns are rules that can be applied to any tablet. So far no one has encountered a tablet with a vowel followed by another vowel, nor has anyone come across a tablet without a single vowel. From this you can safely deduce the format of a tablet.

Vowels:

110101
101101
010101
111011

Other discovered symbols:

110111
110011
110000
101111
101011
101000
010111
010011
010000
111101
111111
111000

입력

The first line of input is an integer N (1 ≤ N ≤ 100) which determines the number of tablets to test. The first line of input for each test case begins with an integer S (1 ≤ S ≤ 1000) determining the number of letters in a word. Each of the next S lines will contain 6 characters chosen from '0', '1' or '?', respectively indicating a circle, a bar or a missing character.

출력

For each test case print out the number of possible words the tablet could have, assuming the tablet follows the grammar rules above and only uses known letters. If there are over 10000 different possible words, print "CANNOT DECIPHER"

제한

예제 입력 1

2
4
010111
111?11
110101
1100??
7
1?????
??????
??????
?????1
??????
??????
?0????

예제 출력 1

2
CANNOT DECIPHER

힌트

출처

ICPC > Regionals > North America > South Central USA Regional > 2012 South Central USA Regional Programming Contest 2번

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

출처

대학교 대회

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

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