結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 17:16:25 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 427 bytes |
| 記録 | |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 20,728 KB |
| 実行使用メモリ | 26,640 KB |
| 最終ジャッジ日時 | 2026-04-18 17:16:44 |
| 合計ジャッジ時間 | 7,023 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 20 |
ソースコード
import re
N = int(input())
a = input()
result = 1
blocks = re.findall('0+|1+', a)
if "1" in blocks[0]:
##n = n - len(blocks[0])
blocks = blocks[1:]
if "0" in blocks[-1]:
##n = n - len(blocks[-1])
blocks = blocks[:-1]
blocks = [len(x) for x in blocks]
for i in range(len(blocks)/2):
index1 = 2*i
index2 = 2*i + 1
result = result*(blocks[index1] + blocks[index2] + 1)
print(result%998244353)