結果

問題 No.3500 01 String
コンテスト
ユーザー カプモカ
提出日時 2026-04-17 23:22:01
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
MLE  
実行時間 -
コード長 646 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,046 ms
コンパイル使用メモリ 20,956 KB
実行使用メモリ 1,310,356 KB
最終ジャッジ日時 2026-04-17 23:22:59
合計ジャッジ時間 10,571 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other MLE * 2 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
from collections import deque

N = int(input().strip())
A = input().strip()

dic = {A}
test = deque([A])
while test:
    target = test.popleft()
    
    for i in range(N - 1):
        if target[i:i+2] == "01":

            target_change1 = target[:i] + "1" + target[i+1:]
            if not(target_change1 in dic):
                dic.add(target_change1)
                test.append(target_change1)

            target_change0 = target[:i+1] + "0" + target[i+2:]
            if not(target_change0 in dic):
                dic.add(target_change0)
                test.append(target_change0)

modulo = len(dic) % 998244353
print(modulo)
0