結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-17 21:15:45 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 653 bytes |
| 記録 | |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 1,340,592 KB |
| 最終ジャッジ日時 | 2026-04-17 21:16:19 |
| 合計ジャッジ時間 | 4,341 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | MLE * 2 -- * 18 |
ソースコード
from collections import deque
N = int(input())
A = input()
M = 998244353
# 次を0に / 前を1に
# 01101; 00101, 00001, 00000
# 00011, 00111, 11111
# 01100, 00100
# 11101, 11100
# 01111
s : set[str] = set()
find = deque([A])
while find:
h = find.popleft()
if h in find:
continue
s.add(h)
for i in range(N-1):
if h[i] == '0' and h[i+1] == '1':
l = h[:i]
r = h[i+2:]
p = l + '00' + r
if p not in s:
find.append(p)
p = l + '11' + r
if p not in s:
find.append(p)
print(len(s) % M)