結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 01:52:49 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 564 bytes |
| 記録 | |
| コンパイル時間 | 789 ms |
| コンパイル使用メモリ | 20,572 KB |
| 実行使用メモリ | 1,311,296 KB |
| 最終ジャッジ日時 | 2026-04-18 01:53:21 |
| 合計ジャッジ時間 | 7,859 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | MLE * 2 -- * 18 |
ソースコード
import re
n = int(input())
a = input()
result = 0
blocks = re.findall('0+|1+', a)
def calc(array):
if len(array) == 1:
return 1
pre = 0
for i in range(len(array)):
if i == 0:
if "1" in array[i]:
continue
elif i == len(array)-1:
if "0" in array[i]:
continue
else:
array1 = array[:i-1] + [array[i-1] + array[i-1][0]*len(array[i]) + array[i+1]] + array[i+2:]
pre += len(array[i]) + calc(array1)
return pre
print(calc(blocks)%998244353)