結果

問題 No.663 セルオートマトンの逆操作
ユーザー Mr.Fuku
提出日時 2018-08-06 19:39:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-19 18:17:42
合計ジャッジ時間 2,007 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cell = ["000","001","010","011","100","101","110","111"]
dic = {"000":0,"001":1,"010":1,"011":1,"100":0,"101":1,"110":1,"111":0}

def check(nummber,x,s_i=0,t_i=3):
    n_set = set()
    for n in nummber:
        if dic[n]==x:
            n_set.add(n[s_i:t_i])
    return n_set

x = int(input())
start_c = check(cell,x,0,3)
c = check(start_c,x,1,3)
for i in range(n-1):
    lst = []
    for j in c:
        lst.append(j+"0")
        lst.append(j+"1")
    x = int(input())
    c = check(lst,x,1,3)

cnt = 0
for i in c:
    for j in range(2):
        if i+str(j) in start_c:
            cnt+=1

print(cnt)
0