結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-17 22:39:23 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 766 bytes |
| 記録 | |
| コンパイル時間 | 651 ms |
| コンパイル使用メモリ | 20,568 KB |
| 実行使用メモリ | 1,311,508 KB |
| 最終ジャッジ日時 | 2026-04-17 22:40:05 |
| 合計ジャッジ時間 | 6,193 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | MLE * 2 -- * 18 |
ソースコード
import sys
import re
N = input().strip()
A = input().strip()
result = 0
dic = [A]
test = [A]
while True:
index = [m.start() for m in re.finditer("01", test[0])]
num = len(index)
for i in range(num):
target = test[0]
target_ind = index[i]
target_change1 = target[:target_ind] + "1" + target[target_ind+1:]
if not(target_change1 in dic):
dic.append(target_change1)
test.append(target_change1)
target_change0 = target[:target_ind+1] + "0" + target[target_ind+2:]
if not(target_change0 in dic):
dic.append(target_change0)
test.append(target_change0)
test.pop(0)
result += 1
if test == []:
break
modulo = result % 998244353
print(modulo)